1 Return-Path: <amdragon@mit.edu>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 1E282431FB6
\r
6 for <notmuch@notmuchmail.org>; Mon, 20 May 2013 13:08:41 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id QdYnnAh5m2op for <notmuch@notmuchmail.org>;
\r
16 Mon, 20 May 2013 13:08:33 -0700 (PDT)
\r
17 Received: from dmz-mailsec-scanner-3.mit.edu (DMZ-MAILSEC-SCANNER-3.MIT.EDU
\r
19 by olra.theworths.org (Postfix) with ESMTP id 8297E431FC0
\r
20 for <notmuch@notmuchmail.org>; Mon, 20 May 2013 13:08:33 -0700 (PDT)
\r
21 X-AuditID: 1209190e-b7f4f6d000005142-08-519a82bf56b8
\r
22 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])
\r
23 by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id 5B.15.20802.FB28A915; Mon, 20 May 2013 16:08:32 -0400 (EDT)
\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH-1.MIT.EDU [18.9.28.11])
\r
26 by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id r4KK8TgP002532;
\r
27 Mon, 20 May 2013 16:08:29 -0400
\r
28 Received: from drake.dyndns.org ([18.111.102.190]) (authenticated bits=0)
\r
29 (User authenticated as amdragon@ATHENA.MIT.EDU)
\r
30 by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r4KK8Qkf031544
\r
31 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);
\r
32 Mon, 20 May 2013 16:08:28 -0400
\r
33 Received: from amthrax by drake.dyndns.org with local (Exim 4.77)
\r
34 (envelope-from <amdragon@mit.edu>)
\r
35 id 1UeWNd-0001pW-U7; Mon, 20 May 2013 16:08:25 -0400
\r
36 From: Austin Clements <amdragon@MIT.EDU>
\r
37 To: notmuch@notmuchmail.org
\r
38 Subject: [PATCH] emacs: Don't override mm-show-part in notmuch-show-view-part
\r
39 Date: Mon, 20 May 2013 16:08:23 -0400
\r
40 Message-Id: <1369080503-6866-1-git-send-email-amdragon@mit.edu>
\r
41 X-Mailer: git-send-email 1.7.10.4
\r
42 In-Reply-To: <20130520170439.GG5999@mit.edu>
\r
43 References: <20130520170439.GG5999@mit.edu>
\r
44 X-Brightmail-Tracker:
\r
45 H4sIAAAAAAAAA+NgFjrOIsWRmVeSWpSXmKPExsUixG6nrnugaVagwePbzBY3WrsZLVbP5bG4
\r
46 fnMmswOzx85Zd9k9nq26xeyx5dB75gDmKC6blNSczLLUIn27BK6M7c8vsxX0CVdc/j6VqYHx
\r
47 MH8XIyeHhICJxMWFb5ggbDGJC/fWs3UxcnEICexjlNjxYDM7hLORUeLXosNQzgomiY2Hu5kg
\r
48 nLmMEv+nrWIG6WcT0JDYtn85I4gtIiAtsfPubFYQm1kgVqLx7TKwGmEBX4nPiz+B2SwCqhIT
\r
49 3s1jAbF5BewlFu7sZIS4Q1Gi+9kENhCbU0BH4uSH22BzhAS0Jd7NWME6gZF/ASPDKkbZlNwq
\r
50 3dzEzJzi1GTd4uTEvLzUIl1jvdzMEr3UlNJNjKDw4pTk28H49aDSIUYBDkYlHl4Bw1mBQqyJ
\r
51 ZcWVuYcYJTmYlER5bRuBQnxJ+SmVGYnFGfFFpTmpxYcYJTiYlUR4o3/PDBTiTUmsrEotyodJ
\r
52 SXOwKInzXkm56S8kkJ5YkpqdmlqQWgSTleHgUJLgbQAZKliUmp5akZaZU4KQZuLgBBnOAzS8
\r
53 HqSGt7ggMbc4Mx0if4pRUUqcNxQkIQCSyCjNg+uFxf8rRnGgV4R5I0CqeICpA677FdBgJqDB
\r
54 2y1Bri4uSURISTUw1nxYGnnsZfJrP66DGeaC5mUNizmfLeljKNWfJrGa78r+K21V+zxup7/6
\r
55 etI82+7g/WCBpQW6BSarxXTlA5Ia11+Lm9dj+MJ/bfuOWfUXCzp2bTnSt8ftSNaB2OczW9Lv
\r
56 Tem13rLjgXel3oQtJo99BSLbTT96qDkozpS+uVW7/mmP0395M4VCJZbijERDLeai4kQARciH
\r
58 X-BeenThere: notmuch@notmuchmail.org
\r
59 X-Mailman-Version: 2.1.13
\r
61 List-Id: "Use and development of the notmuch mail system."
\r
62 <notmuch.notmuchmail.org>
\r
63 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
64 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
65 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
66 List-Post: <mailto:notmuch@notmuchmail.org>
\r
67 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
68 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
69 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
70 X-List-Received-Date: Mon, 20 May 2013 20:08:41 -0000
\r
72 Previously, notmuch-show-view-part overrode the function binding of
\r
73 mm-show-part to redirect it to notmuch-show-save-part to get notmuch's
\r
74 default file name handling in case mm-display-part decided to fall
\r
75 back to saving the part. In addition to being messy, this depended on
\r
76 the now-deprecated dynamic binding behavior of flet.
\r
78 This patch removes the mm-show-part override in favor of passing the
\r
79 file name in to mm-show-part the way it expects, so we get its default
\r
80 file name handling. It's not clear why we didn't do this before;
\r
81 mm-show-part has supported default file names since at least Emacs
\r
85 This takes a different approach from the previous patch by eliminating
\r
86 the function override altogether, so we don't need flet or anything
\r
87 like it. I tested it by hand in Emacs 24.3 and 23.4 and checked that
\r
88 mm-save-part's code has not changed since at least 23.1.
\r
90 emacs/notmuch-show.el | 18 +++++-------------
\r
91 1 file changed, 5 insertions(+), 13 deletions(-)
\r
93 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
94 index 423dd58..19bcb29 100644
\r
95 --- a/emacs/notmuch-show.el
\r
96 +++ b/emacs/notmuch-show.el
\r
97 @@ -529,19 +529,11 @@ message at DEPTH in the current thread."
\r
98 (defun notmuch-show-view-part (message-id nth &optional filename content-type )
\r
99 (notmuch-with-temp-part-buffer message-id nth
\r
100 ;; set mm-inlined-types to nil to force an external viewer
\r
101 - (let ((handle (mm-make-handle (current-buffer) (list content-type)))
\r
102 - (mm-inlined-types nil))
\r
103 - ;; We override mm-save-part as notmuch-show-save-part is better
\r
104 - ;; since it offers the filename. We need to lexically bind
\r
105 - ;; everything we need for notmuch-show-save-part to prevent
\r
106 - ;; potential dynamic shadowing.
\r
107 - (lexical-let ((message-id message-id)
\r
109 - (filename filename)
\r
110 - (content-type content-type))
\r
111 - (flet ((mm-save-part (&rest args) (notmuch-show-save-part
\r
112 - message-id nth filename content-type)))
\r
113 - (mm-display-part handle))))))
\r
114 + (let* ((disposition (if filename `(attachment (filename . ,filename))))
\r
115 + (handle (mm-make-handle (current-buffer) (list content-type)
\r
116 + nil nil disposition))
\r
117 + (mm-inlined-types nil))
\r
118 + (mm-display-part handle))))
\r
120 (defun notmuch-show-interactively-view-part (message-id nth &optional filename content-type)
\r
121 (notmuch-with-temp-part-buffer message-id nth
\r