From 607fd0bb41851fa0538cf54224f57b5de54d7b7a Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Tue, 21 May 2013 16:08:23 +2000 Subject: [PATCH] [PATCH] emacs: Don't override mm-show-part in notmuch-show-view-part --- 10/321d02c7b295b675e792608e484abe440101d2 | 124 ++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 10/321d02c7b295b675e792608e484abe440101d2 diff --git a/10/321d02c7b295b675e792608e484abe440101d2 b/10/321d02c7b295b675e792608e484abe440101d2 new file mode 100644 index 000000000..e9fa41f76 --- /dev/null +++ b/10/321d02c7b295b675e792608e484abe440101d2 @@ -0,0 +1,124 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 1E282431FB6 + for ; Mon, 20 May 2013 13:08:41 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id QdYnnAh5m2op for ; + Mon, 20 May 2013 13:08:33 -0700 (PDT) +Received: from dmz-mailsec-scanner-3.mit.edu (DMZ-MAILSEC-SCANNER-3.MIT.EDU + [18.9.25.14]) + by olra.theworths.org (Postfix) with ESMTP id 8297E431FC0 + for ; Mon, 20 May 2013 13:08:33 -0700 (PDT) +X-AuditID: 1209190e-b7f4f6d000005142-08-519a82bf56b8 +Received: from mailhub-auth-4.mit.edu ( [18.7.62.39]) + by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP + id 5B.15.20802.FB28A915; Mon, 20 May 2013 16:08:32 -0400 (EDT) +Received: from outgoing.mit.edu (OUTGOING-AUTH-1.MIT.EDU [18.9.28.11]) + by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id r4KK8TgP002532; + Mon, 20 May 2013 16:08:29 -0400 +Received: from drake.dyndns.org ([18.111.102.190]) (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r4KK8Qkf031544 + (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); + Mon, 20 May 2013 16:08:28 -0400 +Received: from amthrax by drake.dyndns.org with local (Exim 4.77) + (envelope-from ) + id 1UeWNd-0001pW-U7; Mon, 20 May 2013 16:08:25 -0400 +From: Austin Clements +To: notmuch@notmuchmail.org +Subject: [PATCH] emacs: Don't override mm-show-part in notmuch-show-view-part +Date: Mon, 20 May 2013 16:08:23 -0400 +Message-Id: <1369080503-6866-1-git-send-email-amdragon@mit.edu> +X-Mailer: git-send-email 1.7.10.4 +In-Reply-To: <20130520170439.GG5999@mit.edu> +References: <20130520170439.GG5999@mit.edu> +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFjrOIsWRmVeSWpSXmKPExsUixG6nrnugaVagwePbzBY3WrsZLVbP5bG4 + fnMmswOzx85Zd9k9nq26xeyx5dB75gDmKC6blNSczLLUIn27BK6M7c8vsxX0CVdc/j6VqYHx + MH8XIyeHhICJxMWFb5ggbDGJC/fWs3UxcnEICexjlNjxYDM7hLORUeLXosNQzgomiY2Hu5kg + nLmMEv+nrWIG6WcT0JDYtn85I4gtIiAtsfPubFYQm1kgVqLx7TKwGmEBX4nPiz+B2SwCqhIT + 3s1jAbF5BewlFu7sZIS4Q1Gi+9kENhCbU0BH4uSH22BzhAS0Jd7NWME6gZF/ASPDKkbZlNwq + 3dzEzJzi1GTd4uTEvLzUIl1jvdzMEr3UlNJNjKDw4pTk28H49aDSIUYBDkYlHl4Bw1mBQqyJ + ZcWVuYcYJTmYlER5bRuBQnxJ+SmVGYnFGfFFpTmpxYcYJTiYlUR4o3/PDBTiTUmsrEotyodJ + SXOwKInzXkm56S8kkJ5YkpqdmlqQWgSTleHgUJLgbQAZKliUmp5akZaZU4KQZuLgBBnOAzS8 + HqSGt7ggMbc4Mx0if4pRUUqcNxQkIQCSyCjNg+uFxf8rRnGgV4R5I0CqeICpA677FdBgJqDB + 2y1Bri4uSURISTUw1nxYGnnsZfJrP66DGeaC5mUNizmfLeljKNWfJrGa78r+K21V+zxup7/6 + etI82+7g/WCBpQW6BSarxXTlA5Ia11+Lm9dj+MJ/bfuOWfUXCzp2bTnSt8ftSNaB2OczW9Lv + Tem13rLjgXel3oQtJo99BSLbTT96qDkozpS+uVW7/mmP0395M4VCJZbijERDLeai4kQARciH + 7doCAAA= +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Mon, 20 May 2013 20:08:41 -0000 + +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 takes a different approach from the previous patch by eliminating +the function override altogether, so we don't need flet or anything +like it. I tested it by hand in Emacs 24.3 and 23.4 and checked that +mm-save-part's code has not changed since at least 23.1. + + emacs/notmuch-show.el | 18 +++++------------- + 1 file changed, 5 insertions(+), 13 deletions(-) + +diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +index 423dd58..19bcb29 100644 +--- a/emacs/notmuch-show.el ++++ b/emacs/notmuch-show.el +@@ -529,19 +529,11 @@ 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)) ++ (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 + -- 2.26.2