X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=emacs%2Fnotmuch-show.el;h=654767f5aaf104d22e78eeeaad9034104471d5e6;hb=d4940d47168d0ec0b8ba2bde10c34e8d968cbfa6;hp=652e5dc3c949acb705586dafec273bdc92b0e8b6;hpb=b681aa8235a16630e282626d3938862a6c2f7fd0;p=notmuch diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 652e5dc3..654767f5 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -528,20 +528,15 @@ message at DEPTH in the current thread." (defun notmuch-show-view-part (message-id nth &optional filename content-type ) (notmuch-with-temp-part-buffer message-id nth - ;; set mm-inlined-types to nil to force an external viewer - (let ((handle (mm-make-handle (current-buffer) (list content-type))) - (mm-inlined-types nil)) - ;; We override mm-save-part as notmuch-show-save-part is better - ;; since it offers the filename. We need to lexically bind - ;; everything we need for notmuch-show-save-part to prevent - ;; potential dynamic shadowing. - (lexical-let ((message-id message-id) - (nth nth) - (filename filename) - (content-type content-type)) - (flet ((mm-save-part (&rest args) (notmuch-show-save-part - message-id nth filename content-type))) - (mm-display-part handle)))))) + (let* ((disposition (if filename `(attachment (filename . ,filename)))) + (handle (mm-make-handle (current-buffer) (list content-type) + nil nil disposition)) + ;; Set the default save directory to be consistent with + ;; `notmuch-show-save-part'. + (mm-default-directory (or mailcap-download-directory "~/")) + ;; set mm-inlined-types to nil to force an external viewer + (mm-inlined-types nil)) + (mm-display-part handle)))) (defun notmuch-show-interactively-view-part (message-id nth &optional filename content-type) (notmuch-with-temp-part-buffer message-id nth @@ -815,7 +810,7 @@ message at DEPTH in the current thread." ;; Handler for wash generated inline patch fake parts. (defun notmuch-show-insert-part-inline-patch-fake-part (msg part content-type nth depth declared-type) - (notmuch-show-insert-part-*/* msg part "text/x-diff" nth depth "inline patch")) + (notmuch-show-insert-part-*/* msg part content-type nth depth declared-type)) (defun notmuch-show-insert-part-text/html (msg part content-type nth depth declared-type) ;; text/html handler to work around bugs in renderers and our @@ -889,6 +884,8 @@ If HIDE is non-nil then initially hide this part." (let* ((content-type (downcase (plist-get part :content-type))) (mime-type (or (and (string= content-type "application/octet-stream") (notmuch-show-get-mime-type-of-application/octet-stream part)) + (and (string= content-type "inline patch") + "text/x-diff") content-type)) (nth (plist-get part :id)) (beg (point)))