--- /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 1A50C431FBF\r
+ for <notmuch@notmuchmail.org>; Tue, 21 May 2013 12:13:24 -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 Biy5rqlOYmXL for <notmuch@notmuchmail.org>;\r
+ Tue, 21 May 2013 12:13:16 -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 21F49431FB6\r
+ for <notmuch@notmuchmail.org>; Tue, 21 May 2013 12:13:16 -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 1Uerzj-0004DM-Py; Tue, 21 May 2013 20:13:12 +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 1Uerzj-0000Sa-Gu; Tue, 21 May 2013 20:13:11 +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: <8761ycc19t.fsf@qmul.ac.uk>\r
+References: <20130520170439.GG5999@mit.edu>\r
+ <1369080503-6866-1-git-send-email-amdragon@mit.edu>\r
+ <8761ycc19t.fsf@qmul.ac.uk>\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 20:13:09 +0100\r
+Message-ID: <87fvxguoxm.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: 704dfd3a37b3403df9acaeaf49637546 (of first 20000 bytes)\r
+X-SpamAssassin-Score: -0.1\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.1 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.1 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 19:13:24 -0000\r
+\r
+\r
+On Tue, 21 May 2013, Mark Walters <markwalters1009@gmail.com> wrote:\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
+Here is the code I was using to try using mm-save-part rather than our\r
+own version. I don't know why we have our own version: this does pass\r
+the tests and seems to work (though as mentioned above the semantics of\r
+which default path is used are different)\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+---\r
+ emacs/notmuch-show.el | 13 ++++---------\r
+ 1 files changed, 4 insertions(+), 9 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index 45039bd..a63b857 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -516,15 +516,10 @@ message at DEPTH in the current thread."\r
+ \r
+ (defun notmuch-show-save-part (message-id nth &optional filename content-type)\r
+ (notmuch-with-temp-part-buffer message-id nth\r
+- (let ((file (read-file-name\r
+- "Filename to save as: "\r
+- (or mailcap-download-directory "~/")\r
+- nil nil\r
+- filename)))\r
+- ;; Don't re-compress .gz & al. Arguably we should make\r
+- ;; `file-name-handler-alist' nil, but that would chop\r
+- ;; ange-ftp, which is reasonable to use here.\r
+- (mm-write-region (point-min) (point-max) file nil nil nil 'no-conversion t))))\r
++ (let* ((disposition (if filename `(attachment (filename . ,filename))))\r
++ (handle (mm-make-handle (current-buffer) (list content-type)\r
++ nil nil disposition)))\r
++ (mm-save-part handle))))\r
+ \r
+ (defun notmuch-show-view-part (message-id nth &optional filename content-type )\r
+ (notmuch-with-temp-part-buffer message-id nth\r
+-- \r
+1.7.9.1\r
+\r