]> git.notmuchmail.org Git - notmuch/blobdiff - emacs/notmuch-show.el
emacs: bugfix attachment content-type as mime-type handling
[notmuch] / emacs / notmuch-show.el
index d030ea3f048f3d13e61f957bba2810a469c10a36..82b70bafcd2bc35d4c67d1d827a602f812c4619c 100644 (file)
@@ -213,6 +213,9 @@ For example, if you wanted to remove an \"unread\" tag and add a
   "Enable Visual Line mode."
   (visual-line-mode t))
 
+;; DEPRECATED in Notmuch 0.16 since we now have convenient part
+;; commands.  We'll keep the command around for a version or two in
+;; case people want to bind it themselves.
 (defun notmuch-show-view-all-mime-parts ()
   "Use external viewers to view all attachments from the current message."
   (interactive)
@@ -889,6 +892,9 @@ If HIDE is non-nil then initially hide this part."
                   (notmuch-show-insert-part-header nth mime-type content-type (plist-get part :filename))))
         (content-beg (point)))
 
+    ;; Store the computed mime-type for later use (e.g. by attachment handlers).
+    (plist-put part :computed-type mime-type)
+
     (if (not hide)
         (notmuch-show-insert-bodypart-internal msg part mime-type nth depth button)
       (button-put button :notmuch-lazy-part
@@ -1272,7 +1278,6 @@ reset based on the original query."
        (define-key map "|" 'notmuch-show-pipe-message)
        (define-key map "w" 'notmuch-show-save-attachments)
        (define-key map "V" 'notmuch-show-view-raw-message)
-       (define-key map "v" 'notmuch-show-view-all-mime-parts)
        (define-key map "c" 'notmuch-show-stash-map)
        (define-key map "=" 'notmuch-show-refresh-view)
        (define-key map "h" 'notmuch-show-toggle-visibility-headers)
@@ -1751,7 +1756,10 @@ to stdout or stderr will appear in the *notmuch-pipe* buffer.
 When invoked with a prefix argument, the command will receive all
 open messages in the current thread (formatted as an mbox) rather
 than only the current message."
-  (interactive "P\nsPipe message to command: ")
+  (interactive (let ((query-string (if current-prefix-arg
+                                      "Pipe all open messages to command: "
+                                    "Pipe message to command: ")))
+                (list current-prefix-arg (read-string query-string))))
   (let (shell-command)
     (if entire-thread
        (setq shell-command
@@ -2037,7 +2045,7 @@ the user (see `notmuch-show-stash-mlarchive-link-alist')."
     (with-current-buffer buf
       (setq notmuch-show-process-crypto process-crypto)
       ;; Always acquires the part via `notmuch part', even if it is
-      ;; available in the JSON output.
+      ;; available in the SEXP output.
       (insert (notmuch-get-bodypart-internal message-id nth notmuch-show-process-crypto)))
     buf))
 
@@ -2050,10 +2058,10 @@ caller is responsible for killing this buffer as appropriate."
         (message-id (notmuch-show-get-message-id))
         (nth (plist-get part :id))
         (buf (notmuch-show-generate-part-buffer message-id nth))
-        (content-type (plist-get part :content-type))
+        (computed-type (plist-get part :computed-type))
         (filename (plist-get part :filename))
         (disposition (if filename `(attachment (filename . ,filename)))))
-    (mm-make-handle buf (list content-type) nil nil disposition)))
+    (mm-make-handle buf (list computed-type) nil nil disposition)))
 
 (defun notmuch-show-apply-to-current-part-handle (fn)
   "Apply FN to an mm-handle for the part containing point.