]> git.notmuchmail.org Git - notmuch/blobdiff - emacs/notmuch-show.el
emacs: Improve the acquisition of text parts.
[notmuch] / emacs / notmuch-show.el
index b0d639bfc5334b1ac5347e021fae5cedc7956dd6..7c3444931c0e6f96fca8e4200bf6f21e19860e2f 100644 (file)
@@ -678,7 +678,8 @@ will return nil if the CID is unknown or cannot be retrieved."
              (notmuch-crypto-insert-sigstatus-button sigstatus from))))
     ;; If we're not adding the encryption status, tell the user how
     ;; they can get it.
-    (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts."))
+    (when button
+      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts.")))
 
   (let ((inner-parts (plist-get part :content))
        (start (point)))
@@ -847,21 +848,16 @@ will return nil if the CID is unknown or cannot be retrieved."
 ;; \f
 
 (defun notmuch-show-insert-bodypart-internal (msg part content-type nth depth button)
-  (let ((handlers (notmuch-show-handlers-for content-type)))
-    ;; Run the content handlers until one of them returns a non-nil
-    ;; value.
-    (while (and handlers
-               (not (condition-case err
-                        (funcall (car handlers) msg part content-type nth depth button)
-                      ;; Specifying `debug' here lets the debugger
-                      ;; run if `debug-on-error' is non-nil.
-                      ((debug error)
-                       (progn
-                               (insert "!!! Bodypart insert error: ")
-                               (insert (error-message-string err))
-                               (insert " !!!\n") nil)))))
-      (setq handlers (cdr handlers))))
-  t)
+  ;; Run the handlers until one of them succeeds.
+  (loop for handler in (notmuch-show-handlers-for content-type)
+       until (condition-case err
+                 (funcall handler msg part content-type nth depth button)
+               ;; Specifying `debug' here lets the debugger run if
+               ;; `debug-on-error' is non-nil.
+               ((debug error)
+                (insert "!!! Bodypart handler `" (prin1-to-string handler) "' threw an error:\n"
+                        "!!! " (error-message-string err) "\n")
+                nil))))
 
 (defun notmuch-show-create-part-overlays (button beg end)
   "Add an overlay to the part between BEG and END"
@@ -1856,8 +1852,8 @@ any effects from previous calls to
 (defun notmuch-show-forward-message (&optional prompt-for-sender)
   "Forward the current message."
   (interactive "P")
-  (with-current-notmuch-show-message
-   (notmuch-mua-new-forward-message prompt-for-sender)))
+  (notmuch-mua-new-forward-messages (list (notmuch-show-get-message-id))
+                                   prompt-for-sender))
 
 (put 'notmuch-show-forward-open-messages 'notmuch-prefix-doc
      "... and prompt for sender")