[PATCH v3] Make buttons for attachments allow viewing as well as saving
Mark Walters
markwalters1009 at gmail.com
Tue Jan 17 16:40:22 PST 2012
> Oof, sorry. Two more tweaks that I really should have caught in the
> previous version. After that this gets my automatic +1.
Both fixed. I have also fixed the bug I mentioned (missing filename when
"view" falls back on save); I couldn't make it work with the
"no-default" option. However overriding mm-save-part with flet seems to
do the trick.
+(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
+ (flet ((mm-save-part (&rest args) (ignore)))
+ (or (mm-display-part handle)
+ (notmuch-show-save-part message-id nth filename content-type))))))
Is that a reasonable solution?
Best wishes
Mark
More information about the notmuch
mailing list