1 Return-Path: <wking@tremily.us>
\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 1D5CE431FDB
\r
6 for <notmuch@notmuchmail.org>; Mon, 3 Feb 2014 02:47:01 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
8 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"
\r
12 X-Spam-Status: No, score=0 tagged_above=-999 required=5
\r
13 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001]
\r
15 Received: from olra.theworths.org ([127.0.0.1])
\r
16 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
17 with ESMTP id hXqcYSmZ42YT for <notmuch@notmuchmail.org>;
\r
18 Mon, 3 Feb 2014 02:46:53 -0800 (PST)
\r
19 Received: from qmta09.westchester.pa.mail.comcast.net
\r
20 (qmta09.westchester.pa.mail.comcast.net [76.96.62.96])
\r
21 by olra.theworths.org (Postfix) with ESMTP id 6D39F431E64
\r
22 for <notmuch@notmuchmail.org>; Mon, 3 Feb 2014 02:46:49 -0800 (PST)
\r
23 Received: from omta19.westchester.pa.mail.comcast.net ([76.96.62.98])
\r
24 by qmta09.westchester.pa.mail.comcast.net with comcast
\r
25 id Mml11n00227AodY59mmoUj; Mon, 03 Feb 2014 10:46:48 +0000
\r
26 Received: from odin.tremily.us ([24.18.63.50])
\r
27 by omta19.westchester.pa.mail.comcast.net with comcast
\r
28 id Mmmm1n00H152l3L3fmmniu; Mon, 03 Feb 2014 10:46:48 +0000
\r
29 Received: from mjolnir.tremily.us (unknown [192.168.0.140])
\r
30 by odin.tremily.us (Postfix) with ESMTPS id 7069EFB4C6D;
\r
31 Mon, 3 Feb 2014 02:46:46 -0800 (PST)
\r
32 Received: (nullmailer pid 31481 invoked by uid 1000);
\r
33 Mon, 03 Feb 2014 10:45:49 -0000
\r
34 From: "W. Trevor King" <wking@tremily.us>
\r
35 To: notmuch@notmuchmail.org
\r
36 Subject: [PATCH 2/2] emacs: Prefer Content-Description over filename for part
\r
38 Date: Mon, 3 Feb 2014 02:45:34 -0800
\r
40 <27be295875a7df782a83c9a2c09d06f9d321fe9e.1391423201.git.wking@tremily.us>
\r
41 X-Mailer: git-send-email 1.8.5.2.8.g0f6c0d1
\r
42 In-Reply-To: <cover.1391423201.git.wking@tremily.us>
\r
43 References: <877g9chbay.fsf@qmul.ac.uk>
\r
44 <cover.1391423201.git.wking@tremily.us>
\r
45 In-Reply-To: <cover.1391423201.git.wking@tremily.us>
\r
46 References: <cover.1391423201.git.wking@tremily.us>
\r
47 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;
\r
48 s=q20121106; t=1391424408;
\r
49 bh=96tBw6Uq6odgZ+NkhZWEdU0zmK3yJDwhUfzGj7JGbV0=;
\r
50 h=Received:Received:Received:Received:From:To:Subject:Date:
\r
52 b=Ep6luXOo62iiBkE2X8X2INIQYQtOlOFYs0saa3bzntPL73hqyYo3lGPIoewDya729
\r
53 ppcx3NZQFQ7P2+HTFUOvuGoTIsAsZTu9W5sc4TDyuxJ+mC8SUwkD35kPTtFGjMcoT+
\r
54 JFzhzV7wxRytSJo9RKQfh6ouTFyalOt72+96eSLSgIJeu22my2zx7EGHNMuMgs23be
\r
55 KpE5yzoFSloDNIoNdJ+aHXbwetPh9XBQ09pO2lXpVtZQx9mS1QJ1jwc8t0D7L3jtSq
\r
56 JLBp8LX4CvEs/1FKz1AhAGB3nF8bghewCW8EA9PyOVOKlimYuZ0bEb8Ecogzk1aHng
\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, 03 Feb 2014 10:47:01 -0000
\r
72 On the rss2email list, Victor Orlikowski pointed out [1] that a number
\r
73 of MUAs don't use the Subject header of attached message/rfc822 parts
\r
74 to label multipart/digest subparts [2]. Instead, notmuch and several
\r
75 other MUAs use the filename parameter [3] as a content hint. Using
\r
76 the filename parameter seems more sane than diving into the
\r
77 message/rfc822 part header, but that's still not what the filename
\r
78 parameter was designed for. It makes more sense to me to use the
\r
79 message/rfc822 part's Content-Description header (which I just taught
\r
80 notmuch-show to export), falling back on the filename parameter if
\r
81 Content-Description isn't set.
\r
83 [1]: http://article.gmane.org/gmane.mail.rss2email/211
\r
84 [2]: Digests: http://tools.ietf.org/html/rfc2046#section-5.1.5
\r
85 [3]: Filename: http://tools.ietf.org/search/rfc2183#section-2.3
\r
88 emacs/notmuch-show.el | 4 +-
\r
89 test/T450-emacs-show.sh | 12 ++++
\r
90 test/corpus/cur/24:2, | 1 +
\r
91 .../notmuch-show-buttons-content-description | 84 ++++++++++++++++++++++
\r
92 .../notmuch-show-buttons-filename | 74 +++++++++++++++++++
\r
93 6 files changed, 181 insertions(+), 1 deletion(-)
\r
94 create mode 100644 test/emacs-show.expected-output/notmuch-show-buttons-content-description
\r
95 create mode 100644 test/emacs-show.expected-output/notmuch-show-buttons-filename
\r
97 diff --git a/NEWS b/NEWS
\r
98 index 0f7b1c8..2154872 100644
\r
101 @@ -10,6 +10,13 @@ Command-Line Interface
\r
103 `notmuch show` now includes envelope Content-Description headers.
\r
108 +`notmuch-show` mode prefers Content-Description to filename when
\r
109 +naming part buttons. This is useful for finding interesting parts of
\r
110 +multipart/digest messages, assuming the digest-creator set that field.
\r
112 Notmuch 0.17 (2013-12-30)
\r
113 =========================
\r
115 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
116 index 1ac80ca..dbff3a8 100644
\r
117 --- a/emacs/notmuch-show.el
\r
118 +++ b/emacs/notmuch-show.el
\r
119 @@ -874,13 +874,15 @@ useful for quoting in replies)."
\r
121 (nth (plist-get part :id))
\r
123 + (name (or (plist-get part :content-description)
\r
124 + (plist-get part :filename)))
\r
125 ;; Hide the part initially if HIDE is t.
\r
126 (show-part (not (equal hide t)))
\r
127 ;; We omit the part button for the first (or only) part if
\r
128 ;; this is text/plain, or HIDE is 'no-buttons.
\r
129 (button (unless (or (equal hide 'no-buttons)
\r
130 (and (string= mime-type "text/plain") (<= nth 1)))
\r
131 - (notmuch-show-insert-part-header nth mime-type content-type (plist-get part :filename))))
\r
132 + (notmuch-show-insert-part-header nth mime-type content-type name)))
\r
133 (content-beg (point)))
\r
135 ;; Store the computed mime-type for later use (e.g. by attachment handlers).
\r
136 diff --git a/test/T450-emacs-show.sh b/test/T450-emacs-show.sh
\r
137 index 2a3a535..5650f04 100755
\r
138 --- a/test/T450-emacs-show.sh
\r
139 +++ b/test/T450-emacs-show.sh
\r
140 @@ -106,6 +106,18 @@ test_emacs '(notmuch-search "from:lars@seas.harvard.edu and subject:\"Maildir st
\r
141 (test-visible-output)'
\r
142 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-indent-thread-content-off
\r
144 +test_begin_subtest "buttons prefer Content-Description"
\r
145 +test_emacs '(let ((notmuch-crypto-process-mime nil))
\r
146 + (notmuch-show "id:20091118010116.GC25380@dottiness.seas.harvard.edu")
\r
147 + (test-visible-output))'
\r
148 +test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-buttons-content-description
\r
150 +test_begin_subtest "buttons fallback to filename"
\r
151 +test_emacs '(let ((notmuch-crypto-process-mime nil))
\r
152 + (notmuch-show "id:20091118005829.GB25380@dottiness.seas.harvard.edu")
\r
153 + (test-visible-output))'
\r
154 +test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-buttons-filename
\r
156 test_begin_subtest "id buttonization"
\r
157 add_message '[body]="
\r
159 diff --git a/test/corpus/cur/24:2, b/test/corpus/cur/24:2,
\r
160 index c800020..f9418d2 100644
\r
161 --- a/test/corpus/cur/24:2,
\r
162 +++ b/test/corpus/cur/24:2,
\r
163 @@ -104,6 +104,7 @@ Harvard University School of Engineering and Applied Sciences
\r
166 Content-Type: text/plain; charset=us-ascii
\r
167 +Content-Description: v2 of the selectable usage() stream patch
\r
168 Content-Disposition: attachment; filename="notmuch-help.patch"
\r
169 Content-Transfer-Encoding: quoted-printable
\r
171 diff --git a/test/emacs-show.expected-output/notmuch-show-buttons-content-description b/test/emacs-show.expected-output/notmuch-show-buttons-content-description
\r
172 new file mode 100644
\r
173 index 0000000..622c94e
\r
175 +++ b/test/emacs-show.expected-output/notmuch-show-buttons-content-description
\r
177 +Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-18) (attachment inbox signed unread)
\r
178 +Subject: [notmuch] "notmuch help" outputs to stderr?
\r
179 + Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-18) (attachment inbox signed)
\r
180 + Subject: Re: [notmuch] "notmuch help" outputs to stderr?
\r
181 + To: notmuch <notmuch@notmuchmail.org>
\r
182 + Date: Tue, 17 Nov 2009 20:01:16 -0500
\r
184 + [ multipart/mixed ]
\r
185 + [ multipart/signed ]
\r
186 + [ multipart/mixed ]
\r
188 + > I've attached a patch that lets usage() take a FILE * argument so that
\r
189 + > you can output to stderr in response to usage errors, and stdout in
\r
190 + > response to an explicit request.
\r
192 + Whoops, missed a couple of stderr's in that last patch. New one
\r
195 + [ 4-line signature. Click/Enter to show. ]
\r
196 + [ v2 of the selectable usage() stream patch: text/plain ]
\r
197 + diff --git a/notmuch.c b/notmuch.c
\r
198 + index c47e640..446c810 100644
\r
201 + @@ -157,23 +157,23 @@ command_t commands[] = {
\r
206 + +usage (FILE *out)
\r
208 + command_t *command;
\r
211 + - fprintf (stderr, "Usage: notmuch <command> [args...]\n");
\r
212 + - fprintf (stderr, "\n");
\r
213 + - fprintf (stderr, "Where <command> and [args...] are as follows:\n");
\r
214 + - fprintf (stderr, "\n");
\r
215 + + fprintf (out, "Usage: notmuch <command> [args...]\n");
\r
216 + + fprintf (out, "\n");
\r
217 + + fprintf (out, "Where <command> and [args...] are as follows:\n");
\r
218 + + fprintf (out, "\n");
\r
220 + for (i = 0; i < ARRAY_SIZE (commands); i++) {
\r
221 + command = &commands[i];
\r
223 + - fprintf (stderr, "\t%s\t%s\n\n", command->name, command->summary);
\r
224 + + fprintf (out, "\t%s\t%s\n\n", command->name, command->summary);
\r
227 + - fprintf (stderr, "Use \"notmuch help <command>\" for more details on
\r
228 + each command.\n\n");
\r
229 + + fprintf (out, "Use \"notmuch help <command>\" for more details on each
\r
234 + @@ -183,8 +183,8 @@ notmuch_help_command (unused (void *ctx), int argc, char
\r
239 + - fprintf (stderr, "The notmuch mail system.\n\n");
\r
241 + + fprintf (stdout, "The notmuch mail system.\n\n");
\r
242 + + usage (stdout);
\r
246 + @@ -192,8 +192,8 @@ notmuch_help_command (unused (void *ctx), int argc, char
\r
248 + command = &commands[i];
\r
250 + if (strcmp (argv[0], command->name) == 0) {
\r
251 + - fprintf (stderr, "Help for \"notmuch %s\":\n\n", argv[0]);
\r
252 + - fprintf (stderr, "\t%s\t%s\n\n%s\n\n", command->name,
\r
253 + + fprintf (stdout, "Help for \"notmuch %s\":\n\n", argv[0]);
\r
254 + + fprintf (stdout, "\t%s\t%s\n\n%s\n\n", command->name,
\r
255 + command->summary, command->documentation);
\r
258 + [ application/pgp-signature ]
\r
260 + [ 4-line signature. Click/Enter to show. ]
\r
261 diff --git a/test/emacs-show.expected-output/notmuch-show-buttons-filename b/test/emacs-show.expected-output/notmuch-show-buttons-filename
\r
262 new file mode 100644
\r
263 index 0000000..8fb4d89
\r
265 +++ b/test/emacs-show.expected-output/notmuch-show-buttons-filename
\r
267 +Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-18) (attachment inbox signed)
\r
268 +Subject: [notmuch] "notmuch help" outputs to stderr?
\r
269 +To: notmuch <notmuch@notmuchmail.org>
\r
270 +Date: Tue, 17 Nov 2009 19:58:29 -0500
\r
272 +[ multipart/mixed ]
\r
273 +[ multipart/signed ]
\r
274 +[ multipart/mixed ]
\r
276 +I'm just noticing that 'notmuch help ...' outputs to stderr, which
\r
277 +isn't terribly intuitive. For example, the obvious invocation:
\r
279 + notmuch help | less
\r
281 +...isn't terribly helpful.
\r
283 +I've attached a patch that lets usage() take a FILE * argument so that
\r
284 +you can output to stderr in response to usage errors, and stdout in
\r
285 +response to an explicit request.
\r
287 +[ 4-line signature. Click/Enter to show. ]
\r
288 +[ notmuch-help.patch: text/plain ]
\r
289 +diff --git a/notmuch.c b/notmuch.c
\r
290 +index c47e640..a35cb99 100644
\r
293 +@@ -157,23 +157,23 @@ command_t commands[] = {
\r
298 ++usage (FILE *out)
\r
300 + command_t *command;
\r
303 +- fprintf (stderr, "Usage: notmuch <command> [args...]\n");
\r
304 +- fprintf (stderr, "\n");
\r
305 +- fprintf (stderr, "Where <command> and [args...] are as follows:\n");
\r
306 +- fprintf (stderr, "\n");
\r
307 ++ fprintf (out, "Usage: notmuch <command> [args...]\n");
\r
308 ++ fprintf (out, "\n");
\r
309 ++ fprintf (out, "Where <command> and [args...] are as follows:\n");
\r
310 ++ fprintf (out, "\n");
\r
312 + for (i = 0; i < ARRAY_SIZE (commands); i++) {
\r
313 + command = &commands[i];
\r
315 +- fprintf (stderr, "\t%s\t%s\n\n", command->name, command->summary);
\r
316 ++ fprintf (out, "\t%s\t%s\n\n", command->name, command->summary);
\r
319 +- fprintf (stderr, "Use \"notmuch help <command>\" for more details on each
\r
321 ++ fprintf (out, "Use \"notmuch help <command>\" for more details on each
\r
326 +@@ -183,8 +183,8 @@ notmuch_help_command (unused (void *ctx), int argc, char
\r
331 +- fprintf (stderr, "The notmuch mail system.\n\n");
\r
333 ++ fprintf (stdout, "The notmuch mail system.\n\n");
\r
337 +[ application/pgp-signature ]
\r
339 +[ 4-line signature. Click/Enter to show. ]
\r
340 + Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-18) (attachment inbox signed)
\r