From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/82734 Path: news.gmane.org!not-for-mail From: asjo@koldfront.dk (Adam =?iso-8859-1?Q?Sj=F8gren?=) Newsgroups: gmane.emacs.gnus.general Subject: Re: text/calendar attachments invisible in gnus Date: Tue, 25 Dec 2012 23:51:22 +0100 Organization: koldfront - analysis & revolution, Copenhagen, Denmark Message-ID: <87sj6tycd1.fsf@topper.koldfront.dk> References: <87ehja69wy.fsf@mat.ucm.es> <87k3s8avrk.fsf@kepler.lan> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1356475903 3431 80.91.229.3 (25 Dec 2012 22:51:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 25 Dec 2012 22:51:43 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M31000@lists.math.uh.edu Tue Dec 25 23:51:59 2012 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TndLp-0007ic-FB for ding-account@gmane.org; Tue, 25 Dec 2012 23:51:57 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1TndLU-0001Jr-G6; Tue, 25 Dec 2012 16:51:36 -0600 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1TndLT-0001Jc-02 for ding@lists.math.uh.edu; Tue, 25 Dec 2012 16:51:35 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1TndLR-0008TQ-Hp for ding@lists.math.uh.edu; Tue, 25 Dec 2012 16:51:34 -0600 Original-Received: from plane.gmane.org ([80.91.229.3]) by quimby.gnus.org with esmtp (Exim 4.72) (envelope-from ) id 1TndLQ-0005w7-4x for ding@gnus.org; Tue, 25 Dec 2012 23:51:32 +0100 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1TndLb-0007Yx-TD for ding@gnus.org; Tue, 25 Dec 2012 23:51:43 +0100 Original-Received: from 2505ds5-by.0.fullrate.dk ([89.150.142.116]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 25 Dec 2012 23:51:43 +0100 Original-Received: from asjo by 2505ds5-by.0.fullrate.dk with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 25 Dec 2012 23:51:43 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 98 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 2505ds5-by.0.fullrate.dk OpenPGP: id=21BDE416; url=http://asjo.koldfront.dk/gpg.asc Mail-Follow-Up-To: never X-Now-Playing: Buffalo stance [Sukka mix], Raw like sushi (Neneh Cherry) X-Face: )qY&CseJ?.:=8F#^~GcSA?F=9eu'{KAFfL1C3/A&:nE?PW\i65"ba0NS)97,Q(^@xk}n4Ou rPuR#V8I(J_@~H($[ym:`K_+]*kjvW>xH5jbgLBVFGXY:(#4P>zVBklLbdL&XxL\M)%T}3S/IS9lMJ ^St'=VZBR Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:82734 Archived-At: Hi Leonidas. On Mon, 24 Dec 2012 07:01:35 +0200, Leonidas wrote: > i had posted a recipe for this in the past: > http://lists.gnu.org/archive/html/info-gnus-english/2011-10/msg00046.html > Unfortunately I never figured out how to reply to these messages with > RSVP information and I never continued this patch to smooth some rough > edges like time display incl. timezone etc :/ I hacked a little on your recipe recently (my colleagues got a new version of Outlook and now the HTML parts have no information, none what so ever). I grabbed some of the time zone stuff from one the the .el-files that can import into org-mode (I think it was), and fiddled with various other things (charset and some formatting). I haven't figured the reply-bit out either, because my colleagues look at my calender on the Exchange-server, and I'll bet (but I'll be happy to lose the bet) that you need to use Outlook for that to work. Anyway, here is my butchering of your recipe: (add-to-list 'mm-inlined-types "text/calendar") (add-to-list 'mm-automatic-display "text/calendar") (add-to-list 'mm-inline-media-tests '("text/calendar" mm-inline-text-calendar identity)) (require 'icalendar) (require 'boxquote) (defun mm-inline-text-calendar (handle) (let ((text "")) (with-temp-buffer (mm-insert-part handle) (save-window-excursion (setq info (mapcar (lambda (s) (mm-decode-string s "utf-8")) (format-text-calendar-for-display (icalendar--read-element nil nil)))))) (let ((start (point))) (mm-insert-inline handle "\n") (mm-insert-inline handle (car info)) (mm-insert-inline handle "\n") (goto-char start) (when (search-forward "DESCRIPTION " nil t) (replace-match "" nil t) (beginning-of-line) (fill-region (point) (point-max))) (boxquote-region start (point-max))) (boxquote-title (car (cdr info))) (mm-insert-inline handle "\n"))) (defun format-text-calendar-for-display (element) "Format a text/calendar element parsed by icalendar--read-element into text" (let ((fields '(LOCATION ORGANIZER DESCRIPTION)) (fieldformat "%-11s %s\n") (content "") (first-date "") (last-date "") (title "")) (dolist (event (icalendar--all-events element)) (let* ((zone-map (icalendar--convert-all-timezones element)) (dtstart-zone (icalendar--find-time-zone (icalendar--get-event-property-attributes event 'DTSTART) zone-map)) (dtstart (icalendar--decode-isodatetime (icalendar--get-event-property event 'DTSTART) nil dtstart-zone)) (dtend-zone (icalendar--find-time-zone (icalendar--get-event-property-attributes event 'DTEND) zone-map)) (dtend (icalendar--decode-isodatetime (icalendar--get-event-property event 'DTEND) nil dtend-zone)) (datestring (concat (icalendar--datetime-to-iso-date dtstart "-") " " (icalendar--datetime-to-colontime dtstart) "-" (icalendar--datetime-to-colontime dtend)))) (when (string-equal first-date "") (setq first-date datestring)) (setq last-date datestring) (dolist (field fields) (let ((propertyvalue (mapconcat (lambda (property) (icalendar--convert-string-for-import property) (replace-regexp-in-string "\\\\n" "\n" (replace-regexp-in-string "^MAILTO:" "" property))) (icalendar--get-event-properties event field) " "))) (when (not (string-equal propertyvalue "")) (setq content (concat content (format fieldformat field (replace-regexp-in-string "\\\\ " "" propertyvalue))))))))) (setq content (replace-regexp-in-string "\n\n$" "" content)) (setq title (if (string-equal first-date last-date) first-date (concat first-date " ... " last-date))) (list content title))) I hope some of it is useful. Best regards, Adam -- "But they are all following you! Adam Sjøgren No, they ain't, I'm just in front" asjo@koldfront.dk