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 D2080431FB6
\r
6 for <notmuch@notmuchmail.org>; Sat, 25 May 2013 23:36:52 -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 myOckCsazAax for <notmuch@notmuchmail.org>;
\r
16 Sat, 25 May 2013 23:36:40 -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 96F91431FAF
\r
20 for <notmuch@notmuchmail.org>; Sat, 25 May 2013 23:36:36 -0700 (PDT)
\r
21 X-AuditID: 1209190e-b7f4f6d000005142-01-51a1ad70dec3
\r
22 Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])
\r
23 by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id 0A.B5.20802.07DA1A15; Sun, 26 May 2013 02:36:32 -0400 (EDT)
\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH-1.MIT.EDU [18.9.28.11])
\r
26 by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id r4Q6aV91024635;
\r
27 Sun, 26 May 2013 02:36:31 -0400
\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])
\r
29 (authenticated bits=0)
\r
30 (User authenticated as amdragon@ATHENA.MIT.EDU)
\r
31 by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r4Q6aTTi031911
\r
32 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT);
\r
33 Sun, 26 May 2013 02:36:30 -0400
\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80)
\r
35 (envelope-from <amdragon@mit.edu>)
\r
36 id 1UgUZ9-0005ij-Qw; Sun, 26 May 2013 02:36:27 -0400
\r
37 Date: Sun, 26 May 2013 02:36:27 -0400
\r
38 From: Austin Clements <amdragon@MIT.EDU>
\r
39 To: Mark Walters <markwalters1009@gmail.com>
\r
40 Subject: Re: [PATCH] emacs: Don't override mm-show-part in
\r
41 notmuch-show-view-part
\r
42 Message-ID: <20130526063627.GQ5999@mit.edu>
\r
43 References: <20130520170439.GG5999@mit.edu>
\r
44 <1369080503-6866-1-git-send-email-amdragon@mit.edu>
\r
45 <8761ycc19t.fsf@qmul.ac.uk> <87fvxguoxm.fsf@qmul.ac.uk>
\r
47 Content-Type: text/plain; charset=us-ascii
\r
48 Content-Disposition: inline
\r
49 In-Reply-To: <87fvxguoxm.fsf@qmul.ac.uk>
\r
50 User-Agent: Mutt/1.5.21 (2010-09-15)
\r
51 X-Brightmail-Tracker:
\r
52 H4sIAAAAAAAAA+NgFprFKsWRmVeSWpSXmKPExsUixG6noluwdmGgwaVvJhY3WrsZLVbP5bG4
\r
53 fnMmswOzx85Zd9k9nq26xeyx5dB75gDmKC6blNSczLLUIn27BK6Mm6v+sRVcl6y4MX8ycwPj
\r
54 PpEuRk4OCQETiW9PfjJB2GISF+6tZ+ti5OIQEtjHKNH34goThLORUeLa73OsEM5pJonmHz0s
\r
55 EM4SRolF+ztYQPpZBFQl2jp2MILYbAIaEtv2LwezRQR0JG4fWsAOYjML6Em0z3oGtk9YIFhi
\r
56 3vQmMJtXQFviz74V7BBD5zJKfHu5lQUiIShxcuYTFohmLYkb/14CNXAA2dISy/9xgIQ5gXZ1
\r
57 71jPDGKLCqhITDm5jW0Co9AsJN2zkHTPQuhewMi8ilE2JbdKNzcxM6c4NVm3ODkxLy+1SNdY
\r
58 LzezRC81pXQTIyjYOSX5djB+Pah0iFGAg1GJh1fCYWGgEGtiWXFl7iFGSQ4mJVFezxVAIb6k
\r
59 /JTKjMTijPii0pzU4kOMEhzMSiK8B9WAcrwpiZVVqUX5MClpDhYlcd4rKTf9hQTSE0tSs1NT
\r
60 C1KLYLIyHBxKErwSa4AaBYtS01Mr0jJzShDSTBycIMN5gIZrg9TwFhck5hZnpkPkTzHqcmw+
\r
61 P/kdoxBLXn5eqpQ4rxFIkQBIUUZpHtwcWJJ6xSgO9JYwrwVIFQ8wwcFNegW0hAloyc3c+SBL
\r
62 ShIRUlINjObtOyt4mrVviRfFLgwvf/SmNLDnS4SASLjsTt5P7tzfhI4/7To28+obrxdzWn/s
\r
63 3LrMZ7tT6adtE3SCds8VfcJ+UC5mn0PTVWvlic/YGja1SdQyrN04r/hH9no1ntcfGsIvHkhU
\r
64 5uUrsOHW/X43++ne64fvZfk0fdabWLqm9Qv7s66Duz01HimxFGckGmoxFxUnAgDJkQfeLQMA AA==
\r
65 Cc: notmuch@notmuchmail.org
\r
66 X-BeenThere: notmuch@notmuchmail.org
\r
67 X-Mailman-Version: 2.1.13
\r
69 List-Id: "Use and development of the notmuch mail system."
\r
70 <notmuch.notmuchmail.org>
\r
71 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
72 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
73 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
74 List-Post: <mailto:notmuch@notmuchmail.org>
\r
75 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
76 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
77 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
78 X-List-Received-Date: Sun, 26 May 2013 06:36:55 -0000
\r
80 Quoth Mark Walters on May 21 at 8:13 pm:
\r
82 > On Tue, 21 May 2013, Mark Walters <markwalters1009@gmail.com> wrote:
\r
85 > >> Previously, notmuch-show-view-part overrode the function binding of
\r
86 > >> mm-show-part to redirect it to notmuch-show-save-part to get notmuch's
\r
87 > >> default file name handling in case mm-display-part decided to fall
\r
88 > >> back to saving the part. In addition to being messy, this depended on
\r
89 > >> the now-deprecated dynamic binding behavior of flet.
\r
91 > >> This patch removes the mm-show-part override in favor of passing the
\r
92 > >> file name in to mm-show-part the way it expects, so we get its default
\r
93 > >> file name handling. It's not clear why we didn't do this before;
\r
94 > >> mm-show-part has supported default file names since at least Emacs
\r
97 > > The new code is much simpler (and nicer). However, one small annoyance
\r
98 > > is it makes notmuch-show-save-part and notmuch-show-view-part behave
\r
99 > > differently on parts which can only be saved (eg
\r
100 > > application/octet-stream): view-part (ie mm-save-part) offers the
\r
101 > > current directory (where emacs was started) whereas the notmuch
\r
102 > > save-part explicitly offers mailcap-download-directory or ~/. I have no
\r
103 > > preference which is used but think they should be the same. Perhaps
\r
104 > > notmuch-show-save-part could just call mm-save-part? I have tried that
\r
105 > > and the tests pass. (If we can do that I think the whole part button handling
\r
106 > > stuff could be unified/simplified significantly)
\r
108 > Here is the code I was using to try using mm-save-part rather than our
\r
109 > own version. I don't know why we have our own version: this does pass
\r
110 > the tests and seems to work (though as mentioned above the semantics of
\r
111 > which default path is used are different)
\r
113 I think this is a good idea. I'm putting together a patch that cleans
\r
114 up and simplifies all of the part button handling code by taking
\r
115 better advantage of mm. I should have it ready in the next few days.
\r
122 > emacs/notmuch-show.el | 13 ++++---------
\r
123 > 1 files changed, 4 insertions(+), 9 deletions(-)
\r
125 > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
126 > index 45039bd..a63b857 100644
\r
127 > --- a/emacs/notmuch-show.el
\r
128 > +++ b/emacs/notmuch-show.el
\r
129 > @@ -516,15 +516,10 @@ message at DEPTH in the current thread."
\r
131 > (defun notmuch-show-save-part (message-id nth &optional filename content-type)
\r
132 > (notmuch-with-temp-part-buffer message-id nth
\r
133 > - (let ((file (read-file-name
\r
134 > - "Filename to save as: "
\r
135 > - (or mailcap-download-directory "~/")
\r
138 > - ;; Don't re-compress .gz & al. Arguably we should make
\r
139 > - ;; `file-name-handler-alist' nil, but that would chop
\r
140 > - ;; ange-ftp, which is reasonable to use here.
\r
141 > - (mm-write-region (point-min) (point-max) file nil nil nil 'no-conversion t))))
\r
142 > + (let* ((disposition (if filename `(attachment (filename . ,filename))))
\r
143 > + (handle (mm-make-handle (current-buffer) (list content-type)
\r
144 > + nil nil disposition)))
\r
145 > + (mm-save-part handle))))
\r
147 > (defun notmuch-show-view-part (message-id nth &optional filename content-type )
\r
148 > (notmuch-with-temp-part-buffer message-id nth
\r