]> git.notmuchmail.org Git - notmuch/blobdiff - emacs/notmuch-show.el
emacs/show: restrict inlined mimetypes on refresh.
[notmuch] / emacs / notmuch-show.el
index 527db4bbc0ff346572bdf34f97830264ac7dad38..619337b4461ffd1b2e2bb479e0eeee4c3ecf7228 100644 (file)
@@ -1528,6 +1528,7 @@ non-nil) then the state of the buffer (open/closed messages) is
 reset based on the original query."
   (interactive "P")
   (let ((inhibit-read-only t)
+       (mm-inline-override-types (notmuch--inline-override-types))
        (state (unless reset-state
                 (notmuch-show-capture-state))))
     ;; `erase-buffer' does not seem to remove overlays, which can lead
@@ -1813,7 +1814,7 @@ current thread."
 
 (defun notmuch-show-get-filename ()
   "Return the filename of the current message."
-  (let ((duplicate (or (notmuch-show-get-prop :duplicate) 1)))
+  (let ((duplicate (notmuch-show-get-duplicate)))
     (nth (1- duplicate) (notmuch-show-get-prop :filename))))
 
 (defun notmuch-show-get-header (header &optional props)
@@ -1826,6 +1827,10 @@ current thread."
 (defun notmuch-show-get-date ()
   (notmuch-show-get-header :Date))
 
+(defun notmuch-show-get-duplicate ()
+  ;; if no duplicate property exists, assume first file
+  (or (notmuch-show-get-prop :duplicate) 1))
+
 (defun notmuch-show-get-timestamp ()
   (notmuch-show-get-prop :timestamp))
 
@@ -2139,12 +2144,16 @@ to show, nil otherwise."
   "View the original source of the current message."
   (interactive)
   (let* ((id (notmuch-show-get-message-id))
-        (buf (get-buffer-create (concat "*notmuch-raw-" id "*")))
+        (duplicate (notmuch-show-get-duplicate))
+        (args (if (> duplicate 1)
+                  (list (format "--duplicate=%d" duplicate) id)
+                (list id)))
+        (buf (get-buffer-create (format "*notmuch-raw-%s-%d*" id duplicate)))
         (inhibit-read-only t))
     (pop-to-buffer-same-window buf)
     (erase-buffer)
     (let ((coding-system-for-read 'no-conversion))
-      (notmuch--call-process notmuch-command nil t nil "show" "--format=raw" id))
+      (apply #'notmuch--call-process notmuch-command nil t nil "show" "--format=raw" args))
     (goto-char (point-min))
     (set-buffer-modified-p nil)
     (setq buffer-read-only t)