1 Return-Path: <m.walters@qmul.ac.uk>
\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 1A50C431FBF
\r
6 for <notmuch@notmuchmail.org>; Tue, 21 May 2013 12:13:24 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5
\r
12 tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,
\r
13 NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id Biy5rqlOYmXL for <notmuch@notmuchmail.org>;
\r
17 Tue, 21 May 2013 12:13:16 -0700 (PDT)
\r
18 Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])
\r
19 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id 21F49431FB6
\r
22 for <notmuch@notmuchmail.org>; Tue, 21 May 2013 12:13:16 -0700 (PDT)
\r
23 Received: from smtp.qmul.ac.uk ([138.37.6.40])
\r
24 by mail2.qmul.ac.uk with esmtp (Exim 4.71)
\r
25 (envelope-from <m.walters@qmul.ac.uk>)
\r
26 id 1Uerzj-0004DM-Py; Tue, 21 May 2013 20:13:12 +0100
\r
27 Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost)
\r
28 by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)
\r
29 (envelope-from <m.walters@qmul.ac.uk>)
\r
30 id 1Uerzj-0000Sa-Gu; Tue, 21 May 2013 20:13:11 +0100
\r
31 From: Mark Walters <markwalters1009@gmail.com>
\r
32 To: Austin Clements <amdragon@MIT.EDU>, notmuch@notmuchmail.org
\r
33 Subject: Re: [PATCH] emacs: Don't override mm-show-part in
\r
34 notmuch-show-view-part
\r
35 In-Reply-To: <8761ycc19t.fsf@qmul.ac.uk>
\r
36 References: <20130520170439.GG5999@mit.edu>
\r
37 <1369080503-6866-1-git-send-email-amdragon@mit.edu>
\r
38 <8761ycc19t.fsf@qmul.ac.uk>
\r
39 User-Agent: Notmuch/0.14+255~gff3cc55 (http://notmuchmail.org) Emacs/23.4.1
\r
40 (x86_64-pc-linux-gnu)
\r
41 Date: Tue, 21 May 2013 20:13:09 +0100
\r
42 Message-ID: <87fvxguoxm.fsf@qmul.ac.uk>
\r
44 Content-Type: text/plain; charset=us-ascii
\r
45 X-Sender-Host-Address: 93.97.24.31
\r
46 X-QM-SPAM-Info: Sender has good ham record. :)
\r
47 X-QM-Body-MD5: 704dfd3a37b3403df9acaeaf49637546 (of first 20000 bytes)
\r
48 X-SpamAssassin-Score: -0.1
\r
49 X-SpamAssassin-SpamBar: /
\r
50 X-SpamAssassin-Report: The QM spam filters have analysed this message to
\r
52 spam. We require at least 5.0 points to mark a message as spam.
\r
53 This message scored -0.1 points.
\r
54 Summary of the scoring:
\r
55 * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail
\r
56 provider * (markwalters1009[at]gmail.com)
\r
57 * -0.1 AWL AWL: From: address is in the auto white-list
\r
58 X-QM-Scan-Virus: ClamAV says the message is clean
\r
59 X-BeenThere: notmuch@notmuchmail.org
\r
60 X-Mailman-Version: 2.1.13
\r
62 List-Id: "Use and development of the notmuch mail system."
\r
63 <notmuch.notmuchmail.org>
\r
64 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
65 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
66 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
67 List-Post: <mailto:notmuch@notmuchmail.org>
\r
68 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
69 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
70 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
71 X-List-Received-Date: Tue, 21 May 2013 19:13:24 -0000
\r
74 On Tue, 21 May 2013, Mark Walters <markwalters1009@gmail.com> wrote:
\r
77 >> Previously, notmuch-show-view-part overrode the function binding of
\r
78 >> mm-show-part to redirect it to notmuch-show-save-part to get notmuch's
\r
79 >> default file name handling in case mm-display-part decided to fall
\r
80 >> back to saving the part. In addition to being messy, this depended on
\r
81 >> the now-deprecated dynamic binding behavior of flet.
\r
83 >> This patch removes the mm-show-part override in favor of passing the
\r
84 >> file name in to mm-show-part the way it expects, so we get its default
\r
85 >> file name handling. It's not clear why we didn't do this before;
\r
86 >> mm-show-part has supported default file names since at least Emacs
\r
89 > The new code is much simpler (and nicer). However, one small annoyance
\r
90 > is it makes notmuch-show-save-part and notmuch-show-view-part behave
\r
91 > differently on parts which can only be saved (eg
\r
92 > application/octet-stream): view-part (ie mm-save-part) offers the
\r
93 > current directory (where emacs was started) whereas the notmuch
\r
94 > save-part explicitly offers mailcap-download-directory or ~/. I have no
\r
95 > preference which is used but think they should be the same. Perhaps
\r
96 > notmuch-show-save-part could just call mm-save-part? I have tried that
\r
97 > and the tests pass. (If we can do that I think the whole part button handling
\r
98 > stuff could be unified/simplified significantly)
\r
100 Here is the code I was using to try using mm-save-part rather than our
\r
101 own version. I don't know why we have our own version: this does pass
\r
102 the tests and seems to work (though as mentioned above the semantics of
\r
103 which default path is used are different)
\r
110 emacs/notmuch-show.el | 13 ++++---------
\r
111 1 files changed, 4 insertions(+), 9 deletions(-)
\r
113 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
114 index 45039bd..a63b857 100644
\r
115 --- a/emacs/notmuch-show.el
\r
116 +++ b/emacs/notmuch-show.el
\r
117 @@ -516,15 +516,10 @@ message at DEPTH in the current thread."
\r
119 (defun notmuch-show-save-part (message-id nth &optional filename content-type)
\r
120 (notmuch-with-temp-part-buffer message-id nth
\r
121 - (let ((file (read-file-name
\r
122 - "Filename to save as: "
\r
123 - (or mailcap-download-directory "~/")
\r
126 - ;; Don't re-compress .gz & al. Arguably we should make
\r
127 - ;; `file-name-handler-alist' nil, but that would chop
\r
128 - ;; ange-ftp, which is reasonable to use here.
\r
129 - (mm-write-region (point-min) (point-max) file nil nil nil 'no-conversion t))))
\r
130 + (let* ((disposition (if filename `(attachment (filename . ,filename))))
\r
131 + (handle (mm-make-handle (current-buffer) (list content-type)
\r
132 + nil nil disposition)))
\r
133 + (mm-save-part handle))))
\r
135 (defun notmuch-show-view-part (message-id nth &optional filename content-type )
\r
136 (notmuch-with-temp-part-buffer message-id nth
\r