aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar David Edmondson <dme@dme.org>2010-05-12 09:07:49 +0100
committerGravatar Carl Worth <cworth@cworth.org>2011-05-17 16:34:26 -0700
commit7ca4db2b46dc843b8294d7ff44dced9f74c81c1e (patch)
treefbb80178a834848ef49e2f8955e59788e84fc24e
parentf35813df38c811f35a654cc6e949a21a303a334b (diff)
emacs: Render text/x-vcalendar parts.
Use code from icalendar.el to convert text/x-vcalendar parts to something suitable for use with the Emacs diary. Signed-off-by: Jameson Rollins <jrollins@finestructure.net>
-rw-r--r--emacs/notmuch-show.el19
1 files changed, 19 insertions, 0 deletions
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index b2080032..72c87a1f 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -26,6 +26,7 @@
(require 'message)
(require 'mm-decode)
(require 'mailcap)
+(require 'icalendar)
(require 'notmuch-lib)
(require 'notmuch-query)
@@ -371,6 +372,24 @@ current buffer, if possible."
(run-hook-with-args 'notmuch-show-insert-text/plain-hook depth))))
t)
+(defun notmuch-show-insert-part-text/x-vcalendar (msg part content-type nth depth declared-type)
+ (notmuch-show-insert-part-header nth declared-type content-type (plist-get part :filename))
+ (insert (with-temp-buffer
+ (insert (notmuch-show-get-bodypart-content msg part nth))
+ (goto-char (point-min))
+ (let ((file (make-temp-file "notmuch-ical"))
+ result)
+ (icalendar--convert-ical-to-diary
+ (icalendar--read-element nil nil)
+ file t)
+ (set-buffer (get-file-buffer file))
+ (setq result (buffer-substring (point-min) (point-max)))
+ (set-buffer-modified-p nil)
+ (kill-buffer (current-buffer))
+ (delete-file file)
+ result)))
+ t)
+
(defun notmuch-show-insert-part-application/octet-stream (msg part content-type nth depth declared-type)
;; If we can deduce a MIME type from the filename of the attachment,
;; do so and pass it on to the handler for that type.