After the recent part-handling overhaul, emacs handling of
message/rfc822 parts broke, not outputting the message contents.  This
"fixes" then handling as is, but there are still problems with how
notmuch is outputting message parts that needs to be addressed (for
instance, message headers are not being output at the moment).

This also indicates that we need a test for output of message parts in
emacs.
---
 emacs/notmuch-show.el |   27 ++++++++++++++++-----------
 1 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 9837c7a..714200a 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -516,21 +516,26 @@ current buffer, if possible."
   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")
+  (notmuch-show-insert-part-header nth declared-type content-type nil)
+  (let ((inner-parts (plist-get part :content))
+       (start (point)))
+    (if (plist-member part :headers)
+       (progn
+         ;; 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 "foo\n")))

     ;; Show all of the parts.
     (mapc (lambda (inner-part)
            (notmuch-show-insert-bodypart msg inner-part depth))
-         inner-parts))
+         inner-parts)
+
+    (when notmuch-show-indent-multipart
+      (indent-rigidly start (point) 1)))
   t)

 (defun notmuch-show-insert-part-text/plain (msg part content-type nth depth 
declared-type)
-- 
1.7.4.4

Reply via email to