aboutsummaryrefslogtreecommitdiffhomepage
path: root/emacs
diff options
context:
space:
mode:
authorGravatar Carl Worth <cworth@cworth.org>2011-05-17 15:34:57 -0700
committerGravatar Carl Worth <cworth@cworth.org>2011-05-17 15:58:57 -0700
commit362ab047c264ae67ec3de041aec637979077db21 (patch)
treeb1a14c2f8a8434500b6d67c999570107c266a905 /emacs
parentc51d5b3cdb5ca0816816e88ca6f7136a24e74eee (diff)
notmuch show: Properly nest MIME parts within mulipart parts
Previously, notmuch show flattened all output, losing information about the nesting of the MIME hierarchy. Now, the output is properly nested, (both in the --format=text and --format=json output), so that clients can analyze the original MIME structure. Internally, this required splitting the final closing delimiter out of the various show_part functions and putting it into a new show_part_end function instead. Also, the show_part function now accepts a new "first" argument that is set not only for the first MIME part of a message, but also for each first MIME part within a series of multipart parts. This "first" argument controls the omission of a preceding comma when printing a part (for json). Many thanks to David Edmondson <dme@dme.org> for originally identifying the lack of nesting in the json output and submitting an early implementation of this feature. Thanks as well to Jameson Graef Rollins <jrollins@finestructure.net> for carefully shepherding David's patches through a remarkably long review process, patiently explaining them, and providing a cleaned up series that led to this final implementation. Jameson also provided the new emacs code here.
Diffstat (limited to 'emacs')
-rw-r--r--emacs/notmuch-show.el9
1 files changed, 9 insertions, 0 deletions
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index f3150af5..9f045d7d 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -280,6 +280,15 @@ current buffer, if possible."
t)
nil)))))
+(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)
+ ;; 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,