[feature request] emacs: use `notmuch insert` for FCC
[notmuch-archives.git] / a5 / 65f179751f96adce6d85398f071c15062f140d
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 B05D4431FB6\r
6         for <notmuch@notmuchmail.org>; Mon, 20 May 2013 23:09:38 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -1.098\r
10 X-Spam-Level: \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 gEKrQmhVa9En for <notmuch@notmuchmail.org>;\r
17         Mon, 20 May 2013 23:09:32 -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 B3E7D431FBC\r
22         for <notmuch@notmuchmail.org>; Mon, 20 May 2013 23:09:31 -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 1UeflC-0007Q6-7S; Tue, 21 May 2013 07:09:27 +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 1UeflB-0001SJ-SH; Tue, 21 May 2013 07:09:22 +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: <1369080503-6866-1-git-send-email-amdragon@mit.edu>\r
36 References: <20130520170439.GG5999@mit.edu>\r
37         <1369080503-6866-1-git-send-email-amdragon@mit.edu>\r
38 User-Agent: Notmuch/0.14+255~gff3cc55 (http://notmuchmail.org) Emacs/23.4.1\r
39         (x86_64-pc-linux-gnu)\r
40 Date: Tue, 21 May 2013 07:09:18 +0100\r
41 Message-ID: <8761ycc19t.fsf@qmul.ac.uk>\r
42 MIME-Version: 1.0\r
43 Content-Type: text/plain; charset=us-ascii\r
44 X-Sender-Host-Address: 93.97.24.31\r
45 X-QM-SPAM-Info: Sender has good ham record.  :)\r
46 X-QM-Body-MD5: 6db475ec8ed3e45d4efed38343dceaf0 (of first 20000 bytes)\r
47 X-SpamAssassin-Score: -0.2\r
48 X-SpamAssassin-SpamBar: /\r
49 X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
50         determine if it is\r
51         spam. We require at least 5.0 points to mark a message as spam.\r
52         This message scored -0.2 points.\r
53         Summary of the scoring: \r
54         * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
55         provider *      (markwalters1009[at]gmail.com)\r
56         * -0.2 AWL AWL: From: address is in the auto white-list\r
57 X-QM-Scan-Virus: ClamAV says the message is clean\r
58 X-BeenThere: notmuch@notmuchmail.org\r
59 X-Mailman-Version: 2.1.13\r
60 Precedence: list\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: Tue, 21 May 2013 06:09:39 -0000\r
71 \r
72 \r
73 Hi\r
74 \r
75 > Previously, notmuch-show-view-part overrode the function binding of\r
76 > mm-show-part to redirect it to notmuch-show-save-part to get notmuch's\r
77 > default file name handling in case mm-display-part decided to fall\r
78 > back to saving the part.  In addition to being messy, this depended on\r
79 > the now-deprecated dynamic binding behavior of flet.\r
80 >\r
81 > This patch removes the mm-show-part override in favor of passing the\r
82 > file name in to mm-show-part the way it expects, so we get its default\r
83 > file name handling.  It's not clear why we didn't do this before;\r
84 > mm-show-part has supported default file names since at least Emacs\r
85 > 23.1.\r
86 \r
87 The new code is much simpler (and nicer). However, one small annoyance\r
88 is it makes notmuch-show-save-part and notmuch-show-view-part behave\r
89 differently on parts which can only be saved (eg\r
90 application/octet-stream): view-part (ie mm-save-part) offers the\r
91 current directory (where emacs was started) whereas the notmuch\r
92 save-part explicitly offers mailcap-download-directory or ~/. I have no\r
93 preference which is used but think they should be the same. Perhaps\r
94 notmuch-show-save-part could just call mm-save-part? I have tried that\r
95 and the tests pass. (If we can do that I think the whole part button handling\r
96 stuff could be unified/simplified significantly)\r
97 \r
98 Best wishes\r
99 \r
100 Mark\r
101 \r
102 \r
103 > ---\r
104 >\r
105 > This takes a different approach from the previous patch by eliminating\r
106 > the function override altogether, so we don't need flet or anything\r
107 > like it.  I tested it by hand in Emacs 24.3 and 23.4 and checked that\r
108 > mm-save-part's code has not changed since at least 23.1.\r
109 >\r
110 >  emacs/notmuch-show.el |   18 +++++-------------\r
111 >  1 file changed, 5 insertions(+), 13 deletions(-)\r
112 >\r
113 > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
114 > index 423dd58..19bcb29 100644\r
115 > --- a/emacs/notmuch-show.el\r
116 > +++ b/emacs/notmuch-show.el\r
117 > @@ -529,19 +529,11 @@ message at DEPTH in the current thread."\r
118 >  (defun notmuch-show-view-part (message-id nth &optional filename content-type )\r
119 >    (notmuch-with-temp-part-buffer message-id nth\r
120 >      ;; set mm-inlined-types to nil to force an external viewer\r
121 > -    (let ((handle (mm-make-handle (current-buffer) (list content-type)))\r
122 > -       (mm-inlined-types nil))\r
123 > -      ;; We override mm-save-part as notmuch-show-save-part is better\r
124 > -      ;; since it offers the filename. We need to lexically bind\r
125 > -      ;; everything we need for notmuch-show-save-part to prevent\r
126 > -      ;; potential dynamic shadowing.\r
127 > -      (lexical-let ((message-id message-id)\r
128 > -                 (nth nth)\r
129 > -                 (filename filename)\r
130 > -                 (content-type content-type))\r
131 > -     (flet ((mm-save-part (&rest args) (notmuch-show-save-part\r
132 > -                                        message-id nth filename content-type)))\r
133 > -       (mm-display-part handle))))))\r
134 > +    (let* ((disposition (if filename `(attachment (filename . ,filename))))\r
135 > +        (handle (mm-make-handle (current-buffer) (list content-type)\r
136 > +                                nil nil disposition))\r
137 > +        (mm-inlined-types nil))\r
138 > +      (mm-display-part handle))))\r
139 >  \r
140 >  (defun notmuch-show-interactively-view-part (message-id nth &optional filename content-type)\r
141 >    (notmuch-with-temp-part-buffer message-id nth\r
142 > -- \r
143 > 1.7.10.4\r