--- /dev/null
+Return-Path: <amdragon@mit.edu>\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 D2080431FB6\r
+ for <notmuch@notmuchmail.org>; Sat, 25 May 2013 23:36:52 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 myOckCsazAax for <notmuch@notmuchmail.org>;\r
+ Sat, 25 May 2013 23:36:40 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-3.mit.edu (DMZ-MAILSEC-SCANNER-3.MIT.EDU\r
+ [18.9.25.14])\r
+ by olra.theworths.org (Postfix) with ESMTP id 96F91431FAF\r
+ for <notmuch@notmuchmail.org>; Sat, 25 May 2013 23:36:36 -0700 (PDT)\r
+X-AuditID: 1209190e-b7f4f6d000005142-01-51a1ad70dec3\r
+Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
+ by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP\r
+ id 0A.B5.20802.07DA1A15; Sun, 26 May 2013 02:36:32 -0400 (EDT)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH-1.MIT.EDU [18.9.28.11])\r
+ by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id r4Q6aV91024635; \r
+ Sun, 26 May 2013 02:36:31 -0400\r
+Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
+ (authenticated bits=0)\r
+ (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+ by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r4Q6aTTi031911\r
+ (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT);\r
+ Sun, 26 May 2013 02:36:30 -0400\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80)\r
+ (envelope-from <amdragon@mit.edu>)\r
+ id 1UgUZ9-0005ij-Qw; Sun, 26 May 2013 02:36:27 -0400\r
+Date: Sun, 26 May 2013 02:36:27 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: Mark Walters <markwalters1009@gmail.com>\r
+Subject: Re: [PATCH] emacs: Don't override mm-show-part in\r
+ notmuch-show-view-part\r
+Message-ID: <20130526063627.GQ5999@mit.edu>\r
+References: <20130520170439.GG5999@mit.edu>\r
+ <1369080503-6866-1-git-send-email-amdragon@mit.edu>\r
+ <8761ycc19t.fsf@qmul.ac.uk> <87fvxguoxm.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+In-Reply-To: <87fvxguoxm.fsf@qmul.ac.uk>\r
+User-Agent: Mutt/1.5.21 (2010-09-15)\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFprFKsWRmVeSWpSXmKPExsUixG6noluwdmGgwaVvJhY3WrsZLVbP5bG4\r
+ fnMmswOzx85Zd9k9nq26xeyx5dB75gDmKC6blNSczLLUIn27BK6Mm6v+sRVcl6y4MX8ycwPj\r
+ PpEuRk4OCQETiW9PfjJB2GISF+6tZ+ti5OIQEtjHKNH34goThLORUeLa73OsEM5pJonmHz0s\r
+ EM4SRolF+ztYQPpZBFQl2jp2MILYbAIaEtv2LwezRQR0JG4fWsAOYjML6Em0z3oGtk9YIFhi\r
+ 3vQmMJtXQFviz74V7BBD5zJKfHu5lQUiIShxcuYTFohmLYkb/14CNXAA2dISy/9xgIQ5gXZ1\r
+ 71jPDGKLCqhITDm5jW0Co9AsJN2zkHTPQuhewMi8ilE2JbdKNzcxM6c4NVm3ODkxLy+1SNdY\r
+ LzezRC81pXQTIyjYOSX5djB+Pah0iFGAg1GJh1fCYWGgEGtiWXFl7iFGSQ4mJVFezxVAIb6k\r
+ /JTKjMTijPii0pzU4kOMEhzMSiK8B9WAcrwpiZVVqUX5MClpDhYlcd4rKTf9hQTSE0tSs1NT\r
+ C1KLYLIyHBxKErwSa4AaBYtS01Mr0jJzShDSTBycIMN5gIZrg9TwFhck5hZnpkPkTzHqcmw+\r
+ P/kdoxBLXn5eqpQ4rxFIkQBIUUZpHtwcWJJ6xSgO9JYwrwVIFQ8wwcFNegW0hAloyc3c+SBL\r
+ ShIRUlINjObtOyt4mrVviRfFLgwvf/SmNLDnS4SASLjsTt5P7tzfhI4/7To28+obrxdzWn/s\r
+ 3LrMZ7tT6adtE3SCds8VfcJ+UC5mn0PTVWvlic/YGja1SdQyrN04r/hH9no1ntcfGsIvHkhU\r
+ 5uUrsOHW/X43++ne64fvZfk0fdabWLqm9Qv7s66Duz01HimxFGckGmoxFxUnAgDJkQfeLQMA AA==\r
+Cc: notmuch@notmuchmail.org\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: Sun, 26 May 2013 06:36:55 -0000\r
+\r
+Quoth Mark Walters on May 21 at 8:13 pm:\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
+I think this is a good idea. I'm putting together a patch that cleans\r
+up and simplifies all of the part button handling code by taking\r
+better advantage of mm. I should have it ready in the next few days.\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