From: Tomi Ollila <tomi.ollila@iki.fi>
To: Austin Clements <amdragon@MIT.EDU>, notmuch@notmuchmail.org
Subject: Re: [PATCH v2] emacs: Don't override mm-show-part in notmuch-show-view-part
Date: Sun, 26 May 2013 10:31:13 +0300 [thread overview]
Message-ID: <m238takxj2.fsf@guru.guru-group.fi> (raw)
In-Reply-To: <1369550086-26986-1-git-send-email-amdragon@mit.edu>
On Sun, May 26 2013, Austin Clements <amdragon@MIT.EDU> wrote:
> 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 version overrides the default save directory to make it
> consistent with `notmuch-show-save-part'.
LGTM. +1.
Tomi
>
> emacs/notmuch-show.el | 23 +++++++++--------------
> 1 file changed, 9 insertions(+), 14 deletions(-)
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 423dd58..d773396 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
> --
> 1.7.10.4
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
next prev parent reply other threads:[~2013-05-26 7:31 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-19 11:31 use of flet in notmuch-emacs David Bremner
2013-05-19 15:14 ` [PATCH] emacs: Avoid deprecated function flet Austin Clements
2013-05-20 15:45 ` David Bremner
2013-05-20 17:04 ` Austin Clements
2013-05-20 20:08 ` [PATCH] emacs: Don't override mm-show-part in notmuch-show-view-part Austin Clements
2013-05-21 6:09 ` Mark Walters
2013-05-21 19:13 ` Mark Walters
2013-05-26 6:36 ` Austin Clements
2013-05-26 6:34 ` [PATCH v2] " Austin Clements
2013-05-26 7:04 ` Mark Walters
2013-05-26 7:31 ` Tomi Ollila [this message]
2013-05-26 23:35 ` David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m238takxj2.fsf@guru.guru-group.fi \
--to=tomi.ollila@iki.fi \
--cc=amdragon@MIT.EDU \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).