aboutsummaryrefslogtreecommitdiffhomepage
path: root/emacs
diff options
context:
space:
mode:
authorGravatar David Edmondson <dme@dme.org>2011-05-12 23:09:30 -0700
committerGravatar Carl Worth <cworth@cworth.org>2011-05-17 16:34:26 -0700
commitb741e4dd25d2a25d2ba1cbdbfc4ffbaa8b95223d (patch)
tree858df1349440dafa140b1c752d809989fef22403 /emacs
parent362ab047c264ae67ec3de041aec637979077db21 (diff)
emacs: add more part handling functions
This adds new notmuch-show-insert-part functions to handle multipart/alternative and message/rfc822 parts.
Diffstat (limited to 'emacs')
-rw-r--r--emacs/notmuch-show.el33
1 files changed, 33 insertions, 0 deletions
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 9f045d7d..e08497d9 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -280,6 +280,21 @@ current buffer, if possible."
t)
nil)))))
+(defun notmuch-show-insert-part-multipart/alternative (msg part content-type nth depth declared-type)
+ (let ((inner-parts (plist-get part :content)))
+ (notmuch-show-insert-part-header nth declared-type content-type nil)
+ ;; In most cases, multipart/alternative is used to provide both
+ ;; text/plain and text/html (or multipart/related with text/html
+ ;; and image/*) parts. We might allow the user to express a
+ ;; preference about which part to show, but for the moment we just
+ ;; choose the first. This is usually the text/plain part.
+ (notmuch-show-insert-bodypart msg (car inner-parts) depth)
+ (mapc (lambda (inner-part)
+ (let ((inner-type (concat (plist-get inner-part :content-type) " (not shown)")))
+ (notmuch-show-insert-part-header (plist-get inner-part :id) inner-type inner-type nil)))
+ (cdr inner-parts)))
+ t)
+
(defun notmuch-show-insert-part-multipart/* (msg part content-type nth depth declared-type)
(let ((inner-parts (plist-get part :content)))
(notmuch-show-insert-part-header nth declared-type content-type nil)
@@ -289,6 +304,24 @@ current buffer, if possible."
inner-parts))
t)
+(defun notmuch-show-insert-part-message/rfc822 (msg part content-type nth depth declared-type)
+ (let* ((message-part (plist-get part :content))
+ (inner-parts (plist-get message-part :content)))
+ (notmuch-show-insert-part-header nth declared-type content-type nil)
+ ;; Override `notmuch-message-headers' to force `From' to be
+ ;; displayed.
+ (let ((notmuch-message-headers '("From" "Subject" "To" "Cc" "Date")))
+ (notmuch-show-insert-headers (plist-get part :headers)))
+ ;; Blank line after headers to be compatible with the normal
+ ;; message display.
+ (insert "\n")
+
+ ;; Show all of the parts.
+ (mapc (lambda (inner-part)
+ (notmuch-show-insert-bodypart msg inner-part depth))
+ inner-parts))
+ t)
+
(defun notmuch-show-insert-part-text/plain (msg part content-type nth depth declared-type)
(let ((start (point)))
;; If this text/plain part is not the first part in the message,