mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-25 04:18:08 +01:00
emacs: Don't override mm-show-part in notmuch-show-view-part
Previously, notmuch-show-view-part overrode the function binding of mm-show-part to redirect it to notmuch-show-save-part to get notmuch's default file name handling in case mm-display-part decided to fall back to saving the part. In addition to being messy, this depended on the now-deprecated dynamic binding behavior of flet. This patch removes the mm-show-part override in favor of passing the file name in to mm-show-part the way it expects, so we get its default file name handling. It's not clear why we didn't do this before; mm-show-part has supported default file names since at least Emacs 23.1.
This commit is contained in:
parent
c3c4da7ba8
commit
d4940d4716
1 changed files with 9 additions and 14 deletions
|
@ -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
|
||||
(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
|
||||
(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))))))
|
||||
(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
|
||||
|
|
Loading…
Reference in a new issue