1 Return-Path: <dme@dme.org>
\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 arlo.cworth.org (Postfix) with ESMTP id 57B486DE0130
\r
6 for <notmuch@notmuchmail.org>; Mon, 23 May 2016 05:24:43 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
11 X-Spam-Status: No, score=-0.19 tagged_above=-999 required=5 tests=[AWL=-0.123,
\r
12 DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7,
\r
13 RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_NEUTRAL=0.652,
\r
14 UNPARSEABLE_RELAY=0.001] autolearn=disabled
\r
15 Received: from arlo.cworth.org ([127.0.0.1])
\r
16 by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)
\r
17 with ESMTP id IZyE80VbBkXV for <notmuch@notmuchmail.org>;
\r
18 Mon, 23 May 2016 05:24:35 -0700 (PDT)
\r
19 Received: from mail-wm0-f44.google.com (mail-wm0-f44.google.com
\r
20 [74.125.82.44]) by arlo.cworth.org (Postfix) with ESMTPS id C6B2A6DE00F5 for
\r
21 <notmuch@notmuchmail.org>; Mon, 23 May 2016 05:24:34 -0700 (PDT)
\r
22 Received: by mail-wm0-f44.google.com with SMTP id n129so75746732wmn.1
\r
23 for <notmuch@notmuchmail.org>; Mon, 23 May 2016 05:24:34 -0700 (PDT)
\r
24 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
\r
25 d=dme-org.20150623.gappssmtp.com; s=20150623;
\r
26 h=to:subject:in-reply-to:references:from:date:message-id:mime-version;
\r
27 bh=uqHadXYq+wJaj4SV+THpCKadmphd2QiXY4/GLek7pL0=;
\r
28 b=roffT3SkadsAJl4hy8/P6dZQysV3HF+BsXLWCRQazp+nxK2f92BSHN6I4w84tsbc66
\r
29 WShapiZgbcgzIgOOd26afVsPWmdYAAHgokB/TtgG3b8zhHS0CDOScHAn0lr3vGm/dzDd
\r
30 tzDDEC7KXi5+lXdLbZCwem0c1v7Gs0ZlqWSDglNFSx1k1HGQHCXnfJzIzcf2COS4J4gS
\r
31 WmqvkwRSgavCYENeNPesj21iGWkagipWl9Yt2PbIga631/Q/e4yaZqHi4Y6S7CrIr1lS
\r
32 SBl8Ch+v6ucqXM4bO3pHlK20ART8UZi39aag8voRY2kaKN0vtn5OWydPNXan3RQKJuCC
\r
34 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
\r
35 d=1e100.net; s=20130820;
\r
36 h=x-gm-message-state:to:subject:in-reply-to:references:from:date
\r
37 :message-id:mime-version;
\r
38 bh=uqHadXYq+wJaj4SV+THpCKadmphd2QiXY4/GLek7pL0=;
\r
39 b=Ci0loTgOsJv5vU4gnyJHBGJ1U0N+XLyMe1qjP0/h8fMHN7GbCGzvslDl0iHGctb0fU
\r
40 YU0sbEBzuzQwll8GMVFgG/8PiJ/R3XtQdWzaHRbUGVQ0jgyHIIYT99Wmwuou8/q9MMCO
\r
41 JFCrTAj0tWoIIW5cY730ACwXGuqHMK0XE6Y+FFmhtFRkhCLrSjwYPiROB17D2X+xMeiA
\r
42 D4F+WAQOrt8Psl44asAJ9MphLPpHUIC5mrjDAyUtfZxt/140/hvYNZI1e82CusgvUBn1
\r
43 OySmpJe4Pc5/pBbvZKpFSqfUpLeyxVv6yHjal6Ke803W5jYa3uEBU2RLBvwpD7QAP2Kz
\r
46 AOPr4FXpqS7gOyotql0eAAkN7caI/NI5sd2cE2gKPxhu80coKW8sWr5bKrF/fYDivSqYJg==
\r
47 X-Received: by 10.28.161.198 with SMTP id k189mr17392827wme.23.1464006270831;
\r
48 Mon, 23 May 2016 05:24:30 -0700 (PDT)
\r
49 Received: from disaster-area.hh.sledj.net
\r
50 ([2a01:348:1a2:1:ea39:35ff:fe2c:a227])
\r
51 by smtp.gmail.com with ESMTPSA id iv1sm35017400wjb.34.2016.05.23.05.24.29
\r
52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
\r
53 Mon, 23 May 2016 05:24:29 -0700 (PDT)
\r
54 Received: from localhost (disaster-area.hh.sledj.net [local])
\r
55 by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id 6a2cc922;
\r
56 Mon, 23 May 2016 12:24:28 +0000 (UTC)
\r
57 To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org
\r
58 Subject: Re: [PATCH] emacs: show: allow user to insert rfc822 parts as
\r
60 In-Reply-To: <1463744295-12533-1-git-send-email-markwalters1009@gmail.com>
\r
61 References: <1463744295-12533-1-git-send-email-markwalters1009@gmail.com>
\r
62 From: David Edmondson <dme@dme.org>
\r
63 Date: Mon, 23 May 2016 13:24:28 +0100
\r
64 Message-ID: <m2zirh3qtf.heart-of-gold@dme.org>
\r
66 Content-Type: text/plain
\r
67 X-BeenThere: notmuch@notmuchmail.org
\r
68 X-Mailman-Version: 2.1.20
\r
70 List-Id: "Use and development of the notmuch mail system."
\r
71 <notmuch.notmuchmail.org>
\r
72 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,
\r
73 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
74 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>
\r
75 List-Post: <mailto:notmuch@notmuchmail.org>
\r
76 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
77 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,
\r
78 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
79 X-List-Received-Date: Mon, 23 May 2016 12:24:43 -0000
\r
81 On Fri, May 20 2016, Mark Walters wrote:
\r
83 > This adds a part-handler function that uses notmuch-insert to insert
\r
84 > an rfc822 part as a message in its own right. This allows the user to
\r
85 > reply directly to that message.
\r
87 This looks useful, a couple of minor comments:
\r
89 - it would be nice to have a general "add a file to the database using
\r
90 insert" function rather than the current smashed together with rfc822
\r
92 - the terminology and function naming confused me a lot initially - I
\r
93 had no idea what support was being added. This probably stems from
\r
94 notmuch-show using the term "insert" to mean "add content to the
\r
95 display buffer". Could you come up with a more descriptive name for
\r
96 `notmuch-show-insert-part'?
\r
100 > I receive quite a lot of forwarded messages which include the original
\r
101 > message as an rfc822 part, and have used this for quite some time
\r
102 > without any problems.
\r
109 > emacs/notmuch-show.el | 29 ++++++++++++++++++++++++-----
\r
110 > 1 file changed, 24 insertions(+), 5 deletions(-)
\r
112 > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
113 > index 5d9b7b4..de41a8f 100644
\r
114 > --- a/emacs/notmuch-show.el
\r
115 > +++ b/emacs/notmuch-show.el
\r
116 > @@ -141,6 +141,11 @@ indentation."
\r
117 > (const :tag "View interactively"
\r
118 > notmuch-show-interactively-view-part)))
\r
120 > +(defcustom notmuch-show-part-insert-folder ""
\r
121 > + "Default folder to insert rfc822 parts"
\r
122 > + :group 'notmuch-show
\r
125 > (defcustom notmuch-show-only-matching-messages nil
\r
126 > "Only matching messages are shown by default."
\r
128 > @@ -1403,6 +1408,7 @@ reset based on the original query."
\r
129 > (define-key map "v" 'notmuch-show-view-part)
\r
130 > (define-key map "o" 'notmuch-show-interactively-view-part)
\r
131 > (define-key map "|" 'notmuch-show-pipe-part)
\r
132 > + (define-key map "i" 'notmuch-show-insert-part)
\r
133 > (define-key map "?" 'notmuch-subkeymap-help)
\r
135 > "Submap for part commands")
\r
136 > @@ -2330,11 +2336,13 @@ caller is responsible for killing this buffer as appropriate."
\r
137 > (disposition (if filename `(attachment (filename . ,filename)))))
\r
138 > (mm-make-handle buf (list computed-type) nil nil disposition)))
\r
140 > -(defun notmuch-show-apply-to-current-part-handle (fn)
\r
141 > +(defun notmuch-show-apply-to-current-part-handle (fn &rest args)
\r
142 > "Apply FN to an mm-handle for the part containing point.
\r
144 > -This ensures that the temporary buffer created for the mm-handle
\r
145 > -is destroyed when FN returns."
\r
146 > +Any ARGS are passed to the function FN as arguments after the mm-handle.
\r
148 > +This function ensures that the temporary buffer created for the
\r
149 > +mm-handle is destroyed when FN returns."
\r
150 > (let ((handle (notmuch-show-current-part-handle)))
\r
151 > ;; emacs 24.3+ puts stdout/stderr into the calling buffer so we
\r
152 > ;; call it from a temp-buffer, unless
\r
153 > @@ -2343,9 +2351,9 @@ is destroyed when FN returns."
\r
155 > (if notmuch-show-attachment-debug
\r
156 > (with-current-buffer (generate-new-buffer " *notmuch-part*")
\r
157 > - (funcall fn handle))
\r
158 > + (apply fn handle args))
\r
159 > (with-temp-buffer
\r
160 > - (funcall fn handle)))
\r
161 > + (apply fn handle args)))
\r
162 > (kill-buffer (mm-handle-buffer handle)))))
\r
164 > (defun notmuch-show-part-button-default (&optional button)
\r
165 > @@ -2379,6 +2387,17 @@ is destroyed when FN returns."
\r
167 > (notmuch-show-apply-to-current-part-handle #'mm-pipe-part))
\r
169 > +(defun notmuch-show-insert-part ()
\r
170 > + "If the current part is rfc822 then insert into the mailstore"
\r
172 > + (let* ((part (notmuch-show-get-part-properties))
\r
173 > + (computed-type (plist-get part :computed-type)))
\r
174 > + (if (notmuch-match-content-type computed-type "message/rfc822")
\r
175 > + (let* ((folder (read-from-minibuffer "Folder to save part to: "
\r
176 > + notmuch-show-part-insert-folder))
\r
177 > + (cmd (concat notmuch-command " insert --folder=" folder)))
\r
178 > + (notmuch-show-apply-to-current-part-handle #'mm-pipe-part cmd))
\r
179 > + (message "Not a message/rfc822 part."))))
\r
181 > (provide 'notmuch-show)
\r
186 > _______________________________________________
\r
187 > notmuch mailing list
\r
188 > notmuch@notmuchmail.org
\r
189 > https://notmuchmail.org/mailman/listinfo/notmuch
\r