]> git.notmuchmail.org Git - notmuch/blobdiff - notmuch.el
notmuch.el: Handle attached images via an external viewer.
[notmuch] / notmuch.el
index c0bb55274943832b187a44cf04e6acbb009ba0dc..040997eeaf00eaf4e1cf5a3c604a8fcdf0bb9f71 100644 (file)
@@ -321,13 +321,28 @@ buffer."
          (with-current-buffer buf
            (insert-file-contents filename nil nil nil t)
            ,@body)
-        (kill-buffer buf)))))
+        (kill-buffer buf)))))
 
 (defun notmuch-show-view-all-mime-parts ()
   "Use external viewers to view all attachments from the current message."
   (interactive)
   (with-current-notmuch-show-message
-   (mm-display-parts (mm-dissect-buffer))))
+   ; We ovverride the mm-inline-media-tests to indicate which message
+   ; parts are already sufficiently handled by the original
+   ; presentation of the message in notmuch-show mode. These parts
+   ; will be inserted directly into the temporary buffer of
+   ; with-current-notmuch-show-message and silently discarded.
+   ;
+   ; Any MIME part not explicitly mentioned here will be handled by an
+   ; external viewer as configured in the various mailcap files.
+   (let ((mm-inline-media-tests '(
+                                 ("text/.*" ignore identity)
+                                 ("application/pgp-signature" ignore identity)
+                                 ("multipart/alternative" ignore identity)
+                                 ("multipart/mixed" ignore identity)
+                                 ("multipart/related" ignore identity)
+                                )))
+     (mm-display-parts (mm-dissect-buffer)))))
 
 (defun notmuch-foreach-mime-part (function mm-handle)
   (cond ((stringp (car mm-handle))
@@ -752,7 +767,8 @@ is what to put on the button."
               ; determine whether we've left the current message.
               (if (re-search-forward notmuch-show-part-begin-regexp nil t)
                   (beginning-of-line)))))
-        (goto-char end))))
+        (goto-char end))
+    (goto-char end)))
 
 (defun notmuch-show-markup-parts-region (beg end depth)
   (save-excursion