--- /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 1E282431FB6\r
+ for <notmuch@notmuchmail.org>; Mon, 20 May 2013 13:08:41 -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 QdYnnAh5m2op for <notmuch@notmuchmail.org>;\r
+ Mon, 20 May 2013 13:08:33 -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 8297E431FC0\r
+ for <notmuch@notmuchmail.org>; Mon, 20 May 2013 13:08:33 -0700 (PDT)\r
+X-AuditID: 1209190e-b7f4f6d000005142-08-519a82bf56b8\r
+Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
+ by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP\r
+ id 5B.15.20802.FB28A915; Mon, 20 May 2013 16:08:32 -0400 (EDT)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH-1.MIT.EDU [18.9.28.11])\r
+ by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id r4KK8TgP002532; \r
+ Mon, 20 May 2013 16:08:29 -0400\r
+Received: from drake.dyndns.org ([18.111.102.190]) (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 r4KK8Qkf031544\r
+ (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+ Mon, 20 May 2013 16:08:28 -0400\r
+Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
+ (envelope-from <amdragon@mit.edu>)\r
+ id 1UeWNd-0001pW-U7; Mon, 20 May 2013 16:08:25 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] emacs: Don't override mm-show-part in notmuch-show-view-part\r
+Date: Mon, 20 May 2013 16:08:23 -0400\r
+Message-Id: <1369080503-6866-1-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.7.10.4\r
+In-Reply-To: <20130520170439.GG5999@mit.edu>\r
+References: <20130520170439.GG5999@mit.edu>\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFjrOIsWRmVeSWpSXmKPExsUixG6nrnugaVagwePbzBY3WrsZLVbP5bG4\r
+ fnMmswOzx85Zd9k9nq26xeyx5dB75gDmKC6blNSczLLUIn27BK6M7c8vsxX0CVdc/j6VqYHx\r
+ MH8XIyeHhICJxMWFb5ggbDGJC/fWs3UxcnEICexjlNjxYDM7hLORUeLXosNQzgomiY2Hu5kg\r
+ nLmMEv+nrWIG6WcT0JDYtn85I4gtIiAtsfPubFYQm1kgVqLx7TKwGmEBX4nPiz+B2SwCqhIT\r
+ 3s1jAbF5BewlFu7sZIS4Q1Gi+9kENhCbU0BH4uSH22BzhAS0Jd7NWME6gZF/ASPDKkbZlNwq\r
+ 3dzEzJzi1GTd4uTEvLzUIl1jvdzMEr3UlNJNjKDw4pTk28H49aDSIUYBDkYlHl4Bw1mBQqyJ\r
+ ZcWVuYcYJTmYlER5bRuBQnxJ+SmVGYnFGfFFpTmpxYcYJTiYlUR4o3/PDBTiTUmsrEotyodJ\r
+ SXOwKInzXkm56S8kkJ5YkpqdmlqQWgSTleHgUJLgbQAZKliUmp5akZaZU4KQZuLgBBnOAzS8\r
+ HqSGt7ggMbc4Mx0if4pRUUqcNxQkIQCSyCjNg+uFxf8rRnGgV4R5I0CqeICpA677FdBgJqDB\r
+ 2y1Bri4uSURISTUw1nxYGnnsZfJrP66DGeaC5mUNizmfLeljKNWfJrGa78r+K21V+zxup7/6\r
+ etI82+7g/WCBpQW6BSarxXTlA5Ia11+Lm9dj+MJ/bfuOWfUXCzp2bTnSt8ftSNaB2OczW9Lv\r
+ Tem13rLjgXel3oQtJo99BSLbTT96qDkozpS+uVW7/mmP0395M4VCJZbijERDLeai4kQARciH\r
+ 7doCAAA=\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: Mon, 20 May 2013 20:08:41 -0000\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
+\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
+\r