--- /dev/null
+Return-Path: <m.walters@qmul.ac.uk>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id B05D4431FB6\r
+ for <notmuch@notmuchmail.org>; Mon, 20 May 2013 23:09:38 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.098\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
+ tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
+ NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id gEKrQmhVa9En for <notmuch@notmuchmail.org>;\r
+ Mon, 20 May 2013 23:09:32 -0700 (PDT)\r
+Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
+ (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id B3E7D431FBC\r
+ for <notmuch@notmuchmail.org>; Mon, 20 May 2013 23:09:31 -0700 (PDT)\r
+Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
+ by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1UeflC-0007Q6-7S; Tue, 21 May 2013 07:09:27 +0100\r
+Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost)\r
+ by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1UeflB-0001SJ-SH; Tue, 21 May 2013 07:09:22 +0100\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: Austin Clements <amdragon@MIT.EDU>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH] emacs: Don't override mm-show-part in\r
+ notmuch-show-view-part\r
+In-Reply-To: <1369080503-6866-1-git-send-email-amdragon@mit.edu>\r
+References: <20130520170439.GG5999@mit.edu>\r
+ <1369080503-6866-1-git-send-email-amdragon@mit.edu>\r
+User-Agent: Notmuch/0.14+255~gff3cc55 (http://notmuchmail.org) Emacs/23.4.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Tue, 21 May 2013 07:09:18 +0100\r
+Message-ID: <8761ycc19t.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Sender-Host-Address: 93.97.24.31\r
+X-QM-SPAM-Info: Sender has good ham record. :)\r
+X-QM-Body-MD5: 6db475ec8ed3e45d4efed38343dceaf0 (of first 20000 bytes)\r
+X-SpamAssassin-Score: -0.2\r
+X-SpamAssassin-SpamBar: /\r
+X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
+ determine if it is\r
+ spam. We require at least 5.0 points to mark a message as spam.\r
+ This message scored -0.2 points.\r
+ Summary of the scoring: \r
+ * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
+ provider * (markwalters1009[at]gmail.com)\r
+ * -0.2 AWL AWL: From: address is in the auto white-list\r
+X-QM-Scan-Virus: ClamAV says the message is clean\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 21 May 2013 06:09:39 -0000\r
+\r
+\r
+Hi\r
+\r
+> Previously, notmuch-show-view-part overrode the function binding of\r
+> mm-show-part to redirect it to notmuch-show-save-part to get notmuch's\r
+> default file name handling in case mm-display-part decided to fall\r
+> back to saving the part. In addition to being messy, this depended on\r
+> the now-deprecated dynamic binding behavior of flet.\r
+>\r
+> This patch removes the mm-show-part override in favor of passing the\r
+> file name in to mm-show-part the way it expects, so we get its default\r
+> file name handling. It's not clear why we didn't do this before;\r
+> mm-show-part has supported default file names since at least Emacs\r
+> 23.1.\r
+\r
+The new code is much simpler (and nicer). However, one small annoyance\r
+is it makes notmuch-show-save-part and notmuch-show-view-part behave\r
+differently on parts which can only be saved (eg\r
+application/octet-stream): view-part (ie mm-save-part) offers the\r
+current directory (where emacs was started) whereas the notmuch\r
+save-part explicitly offers mailcap-download-directory or ~/. I have no\r
+preference which is used but think they should be the same. Perhaps\r
+notmuch-show-save-part could just call mm-save-part? I have tried that\r
+and the tests pass. (If we can do that I think the whole part button handling\r
+stuff could be unified/simplified significantly)\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+\r
+> ---\r
+>\r
+> This takes a different approach from the previous patch by eliminating\r
+> the function override altogether, so we don't need flet or anything\r
+> like it. I tested it by hand in Emacs 24.3 and 23.4 and checked that\r
+> mm-save-part's code has not changed since at least 23.1.\r
+>\r
+> emacs/notmuch-show.el | 18 +++++-------------\r
+> 1 file changed, 5 insertions(+), 13 deletions(-)\r
+>\r
+> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+> index 423dd58..19bcb29 100644\r
+> --- a/emacs/notmuch-show.el\r
+> +++ b/emacs/notmuch-show.el\r
+> @@ -529,19 +529,11 @@ message at DEPTH in the current thread."\r
+> (defun notmuch-show-view-part (message-id nth &optional filename content-type )\r
+> (notmuch-with-temp-part-buffer message-id nth\r
+> ;; set mm-inlined-types to nil to force an external viewer\r
+> - (let ((handle (mm-make-handle (current-buffer) (list content-type)))\r
+> - (mm-inlined-types nil))\r
+> - ;; We override mm-save-part as notmuch-show-save-part is better\r
+> - ;; since it offers the filename. We need to lexically bind\r
+> - ;; everything we need for notmuch-show-save-part to prevent\r
+> - ;; potential dynamic shadowing.\r
+> - (lexical-let ((message-id message-id)\r
+> - (nth nth)\r
+> - (filename filename)\r
+> - (content-type content-type))\r
+> - (flet ((mm-save-part (&rest args) (notmuch-show-save-part\r
+> - message-id nth filename content-type)))\r
+> - (mm-display-part handle))))))\r
+> + (let* ((disposition (if filename `(attachment (filename . ,filename))))\r
+> + (handle (mm-make-handle (current-buffer) (list content-type)\r
+> + nil nil disposition))\r
+> + (mm-inlined-types nil))\r
+> + (mm-display-part handle))))\r
+> \r
+> (defun notmuch-show-interactively-view-part (message-id nth &optional filename content-type)\r
+> (notmuch-with-temp-part-buffer message-id nth\r
+> -- \r
+> 1.7.10.4\r