--- /dev/null
+Return-Path: <tomi.ollila@iki.fi>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 28497431FAF\r
+ for <notmuch@notmuchmail.org>; Mon, 3 Feb 2014 12:44:59 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+ autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id NQlWh3juuj0r for <notmuch@notmuchmail.org>;\r
+ Mon, 3 Feb 2014 12:44:51 -0800 (PST)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by olra.theworths.org (Postfix) with ESMTP id 8F74A431FBC\r
+ for <notmuch@notmuchmail.org>; Mon, 3 Feb 2014 12:44:50 -0800 (PST)\r
+Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
+ by guru.guru-group.fi (Postfix) with ESMTP id 3E4A4100033;\r
+ Mon, 3 Feb 2014 22:44:39 +0200 (EET)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: "W. Trevor King" <wking@tremily.us>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH 2/2] emacs: Prefer Content-Description over filename for\r
+ part buttons\r
+In-Reply-To:\r
+ <27be295875a7df782a83c9a2c09d06f9d321fe9e.1391423201.git.wking@tremily.us>\r
+References: <877g9chbay.fsf@qmul.ac.uk>\r
+ <cover.1391423201.git.wking@tremily.us>\r
+ <27be295875a7df782a83c9a2c09d06f9d321fe9e.1391423201.git.wking@tremily.us>\r
+User-Agent: Notmuch/0.17+55~g4397960 (http://notmuchmail.org) Emacs/24.3.1\r
+ (x86_64-unknown-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+ $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+ !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Mon, 03 Feb 2014 22:44:39 +0200\r
+Message-ID: <m2k3dcq62w.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 03 Feb 2014 20:44:59 -0000\r
+\r
+On Mon, Feb 03 2014, "W. Trevor King" <wking@tremily.us> wrote:\r
+\r
+> On the rss2email list, Victor Orlikowski pointed out [1] that a number\r
+> of MUAs don't use the Subject header of attached message/rfc822 parts\r
+> to label multipart/digest subparts [2]. Instead, notmuch and several\r
+> other MUAs use the filename parameter [3] as a content hint. Using\r
+> the filename parameter seems more sane than diving into the\r
+> message/rfc822 part header, but that's still not what the filename\r
+> parameter was designed for. It makes more sense to me to use the\r
+> message/rfc822 part's Content-Description header (which I just taught\r
+> notmuch-show to export), falling back on the filename parameter if\r
+> Content-Description isn't set.\r
+\r
+Series looks good, although having notmuch patch email as expected test\r
+output feels a bit confusing to me -- especially as 'git grep' may\r
+catch some of the (possibly future-outdated) content...\r
+\r
+Tomi\r
+\r
+\r
+>\r
+> [1]: http://article.gmane.org/gmane.mail.rss2email/211\r
+> [2]: Digests: http://tools.ietf.org/html/rfc2046#section-5.1.5\r
+> [3]: Filename: http://tools.ietf.org/search/rfc2183#section-2.3\r
+> ---\r
+> NEWS | 7 ++\r
+> emacs/notmuch-show.el | 4 +-\r
+> test/T450-emacs-show.sh | 12 ++++\r
+> test/corpus/cur/24:2, | 1 +\r
+> .../notmuch-show-buttons-content-description | 84 ++++++++++++++++++++++\r
+> .../notmuch-show-buttons-filename | 74 +++++++++++++++++++\r
+> 6 files changed, 181 insertions(+), 1 deletion(-)\r
+> create mode 100644 test/emacs-show.expected-output/notmuch-show-buttons-content-description\r
+> create mode 100644 test/emacs-show.expected-output/notmuch-show-buttons-filename\r
+>\r
+> diff --git a/NEWS b/NEWS\r
+> index 0f7b1c8..2154872 100644\r
+> --- a/NEWS\r
+> +++ b/NEWS\r
+> @@ -10,6 +10,13 @@ Command-Line Interface\r
+> \r
+> `notmuch show` now includes envelope Content-Description headers.\r
+> \r
+> +Emacs Interface\r
+> +---------------\r
+> +\r
+> +`notmuch-show` mode prefers Content-Description to filename when\r
+> +naming part buttons. This is useful for finding interesting parts of\r
+> +multipart/digest messages, assuming the digest-creator set that field.\r
+> +\r
+> Notmuch 0.17 (2013-12-30)\r
+> =========================\r
+> \r
+> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+> index 1ac80ca..dbff3a8 100644\r
+> --- a/emacs/notmuch-show.el\r
+> +++ b/emacs/notmuch-show.el\r
+> @@ -874,13 +874,15 @@ useful for quoting in replies)."\r
+> content-type))\r
+> (nth (plist-get part :id))\r
+> (beg (point))\r
+> + (name (or (plist-get part :content-description)\r
+> + (plist-get part :filename)))\r
+> ;; Hide the part initially if HIDE is t.\r
+> (show-part (not (equal hide t)))\r
+> ;; We omit the part button for the first (or only) part if\r
+> ;; this is text/plain, or HIDE is 'no-buttons.\r
+> (button (unless (or (equal hide 'no-buttons)\r
+> (and (string= mime-type "text/plain") (<= nth 1)))\r
+> - (notmuch-show-insert-part-header nth mime-type content-type (plist-get part :filename))))\r
+> + (notmuch-show-insert-part-header nth mime-type content-type name)))\r
+> (content-beg (point)))\r
+> \r
+> ;; Store the computed mime-type for later use (e.g. by attachment handlers).\r
+> diff --git a/test/T450-emacs-show.sh b/test/T450-emacs-show.sh\r
+> index 2a3a535..5650f04 100755\r
+> --- a/test/T450-emacs-show.sh\r
+> +++ b/test/T450-emacs-show.sh\r
+> @@ -106,6 +106,18 @@ test_emacs '(notmuch-search "from:lars@seas.harvard.edu and subject:\"Maildir st\r
+> (test-visible-output)'\r
+> test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-indent-thread-content-off\r
+> \r
+> +test_begin_subtest "buttons prefer Content-Description"\r
+> +test_emacs '(let ((notmuch-crypto-process-mime nil))\r
+> + (notmuch-show "id:20091118010116.GC25380@dottiness.seas.harvard.edu")\r
+> + (test-visible-output))'\r
+> +test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-buttons-content-description\r
+> +\r
+> +test_begin_subtest "buttons fallback to filename"\r
+> +test_emacs '(let ((notmuch-crypto-process-mime nil))\r
+> + (notmuch-show "id:20091118005829.GB25380@dottiness.seas.harvard.edu")\r
+> + (test-visible-output))'\r
+> +test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-buttons-filename\r
+> +\r
+> test_begin_subtest "id buttonization"\r
+> add_message '[body]="\r
+> id:abc\r
+> diff --git a/test/corpus/cur/24:2, b/test/corpus/cur/24:2,\r
+> index c800020..f9418d2 100644\r
+> --- a/test/corpus/cur/24:2,\r
+> +++ b/test/corpus/cur/24:2,\r
+> @@ -104,6 +104,7 @@ Harvard University School of Engineering and Applied Sciences\r
+> \r
+> --KdquIMZPjGJQvRdI\r
+> Content-Type: text/plain; charset=us-ascii\r
+> +Content-Description: v2 of the selectable usage() stream patch\r
+> Content-Disposition: attachment; filename="notmuch-help.patch"\r
+> Content-Transfer-Encoding: quoted-printable\r
+> \r
+> 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
+> new file mode 100644\r
+> index 0000000..622c94e\r
+> --- /dev/null\r
+> +++ b/test/emacs-show.expected-output/notmuch-show-buttons-content-description\r
+> @@ -0,0 +1,84 @@\r
+> +Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-18) (attachment inbox signed unread)\r
+> +Subject: [notmuch] "notmuch help" outputs to stderr?\r
+> + Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-18) (attachment inbox signed)\r
+> + Subject: Re: [notmuch] "notmuch help" outputs to stderr?\r
+> + To: notmuch <notmuch@notmuchmail.org>\r
+> + Date: Tue, 17 Nov 2009 20:01:16 -0500\r
+> +\r
+> + [ multipart/mixed ]\r
+> + [ multipart/signed ]\r
+> + [ multipart/mixed ]\r
+> + [ text/plain ]\r
+> + > I've attached a patch that lets usage() take a FILE * argument so that\r
+> + > you can output to stderr in response to usage errors, and stdout in\r
+> + > response to an explicit request.\r
+> +\r
+> + Whoops, missed a couple of stderr's in that last patch. New one\r
+> + attached.\r
+> +\r
+> + [ 4-line signature. Click/Enter to show. ]\r
+> + [ v2 of the selectable usage() stream patch: text/plain ]\r
+> + diff --git a/notmuch.c b/notmuch.c\r
+> + index c47e640..446c810 100644\r
+> + --- a/notmuch.c\r
+> + +++ b/notmuch.c\r
+> + @@ -157,23 +157,23 @@ command_t commands[] = {\r
+> + };\r
+> +\r
+> + static void\r
+> + -usage (void)\r
+> + +usage (FILE *out)\r
+> + {\r
+> + command_t *command;\r
+> + unsigned int i;\r
+> +\r
+> + - fprintf (stderr, "Usage: notmuch <command> [args...]\n");\r
+> + - fprintf (stderr, "\n");\r
+> + - fprintf (stderr, "Where <command> and [args...] are as follows:\n");\r
+> + - fprintf (stderr, "\n");\r
+> + + fprintf (out, "Usage: notmuch <command> [args...]\n");\r
+> + + fprintf (out, "\n");\r
+> + + fprintf (out, "Where <command> and [args...] are as follows:\n");\r
+> + + fprintf (out, "\n");\r
+> +\r
+> + for (i = 0; i < ARRAY_SIZE (commands); i++) {\r
+> + command = &commands[i];\r
+> +\r
+> + - fprintf (stderr, "\t%s\t%s\n\n", command->name, command->summary);\r
+> + + fprintf (out, "\t%s\t%s\n\n", command->name, command->summary);\r
+> + }\r
+> +\r
+> + - fprintf (stderr, "Use \"notmuch help <command>\" for more details on\r
+> + each command.\n\n");\r
+> + + fprintf (out, "Use \"notmuch help <command>\" for more details on each\r
+> + command.\n\n");\r
+> + }\r
+> +\r
+> + static int\r
+> + @@ -183,8 +183,8 @@ notmuch_help_command (unused (void *ctx), int argc, char\r
+> + *argv[])\r
+> + unsigned int i;\r
+> +\r
+> + if (argc == 0) {\r
+> + - fprintf (stderr, "The notmuch mail system.\n\n");\r
+> + - usage ();\r
+> + + fprintf (stdout, "The notmuch mail system.\n\n");\r
+> + + usage (stdout);\r
+> + return 0;\r
+> + }\r
+> +\r
+> + @@ -192,8 +192,8 @@ notmuch_help_command (unused (void *ctx), int argc, char\r
+> + *argv[])\r
+> + command = &commands[i];\r
+> +\r
+> + if (strcmp (argv[0], command->name) == 0) {\r
+> + - fprintf (stderr, "Help for \"notmuch %s\":\n\n", argv[0]);\r
+> + - fprintf (stderr, "\t%s\t%s\n\n%s\n\n", command->name,\r
+> + + fprintf (stdout, "Help for \"notmuch %s\":\n\n", argv[0]);\r
+> + + fprintf (stdout, "\t%s\t%s\n\n%s\n\n", command->name,\r
+> + command->summary, command->documentation);\r
+> + return 0;\r
+> + }\r
+> + [ application/pgp-signature ]\r
+> + [ text/plain ]\r
+> + [ 4-line signature. Click/Enter to show. ]\r
+> diff --git a/test/emacs-show.expected-output/notmuch-show-buttons-filename b/test/emacs-show.expected-output/notmuch-show-buttons-filename\r
+> new file mode 100644\r
+> index 0000000..8fb4d89\r
+> --- /dev/null\r
+> +++ b/test/emacs-show.expected-output/notmuch-show-buttons-filename\r
+> @@ -0,0 +1,74 @@\r
+> +Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-18) (attachment inbox signed)\r
+> +Subject: [notmuch] "notmuch help" outputs to stderr?\r
+> +To: notmuch <notmuch@notmuchmail.org>\r
+> +Date: Tue, 17 Nov 2009 19:58:29 -0500\r
+> +\r
+> +[ multipart/mixed ]\r
+> +[ multipart/signed ]\r
+> +[ multipart/mixed ]\r
+> +[ text/plain ]\r
+> +I'm just noticing that 'notmuch help ...' outputs to stderr, which\r
+> +isn't terribly intuitive. For example, the obvious invocation:\r
+> +\r
+> + notmuch help | less\r
+> +\r
+> +...isn't terribly helpful.\r
+> +\r
+> +I've attached a patch that lets usage() take a FILE * argument so that\r
+> +you can output to stderr in response to usage errors, and stdout in\r
+> +response to an explicit request.\r
+> +\r
+> +[ 4-line signature. Click/Enter to show. ]\r
+> +[ notmuch-help.patch: text/plain ]\r
+> +diff --git a/notmuch.c b/notmuch.c\r
+> +index c47e640..a35cb99 100644\r
+> +--- a/notmuch.c\r
+> ++++ b/notmuch.c\r
+> +@@ -157,23 +157,23 @@ command_t commands[] = {\r
+> + };\r
+> +\r
+> + static void\r
+> +-usage (void)\r
+> ++usage (FILE *out)\r
+> + {\r
+> + command_t *command;\r
+> + unsigned int i;\r
+> +\r
+> +- fprintf (stderr, "Usage: notmuch <command> [args...]\n");\r
+> +- fprintf (stderr, "\n");\r
+> +- fprintf (stderr, "Where <command> and [args...] are as follows:\n");\r
+> +- fprintf (stderr, "\n");\r
+> ++ fprintf (out, "Usage: notmuch <command> [args...]\n");\r
+> ++ fprintf (out, "\n");\r
+> ++ fprintf (out, "Where <command> and [args...] are as follows:\n");\r
+> ++ fprintf (out, "\n");\r
+> +\r
+> + for (i = 0; i < ARRAY_SIZE (commands); i++) {\r
+> + command = &commands[i];\r
+> +\r
+> +- fprintf (stderr, "\t%s\t%s\n\n", command->name, command->summary);\r
+> ++ fprintf (out, "\t%s\t%s\n\n", command->name, command->summary);\r
+> + }\r
+> +\r
+> +- fprintf (stderr, "Use \"notmuch help <command>\" for more details on each\r
+> +command.\n\n");\r
+> ++ fprintf (out, "Use \"notmuch help <command>\" for more details on each\r
+> +command.\n\n");\r
+> + }\r
+> +\r
+> + static int\r
+> +@@ -183,8 +183,8 @@ notmuch_help_command (unused (void *ctx), int argc, char\r
+> +*argv[])\r
+> + unsigned int i;\r
+> +\r
+> + if (argc == 0) {\r
+> +- fprintf (stderr, "The notmuch mail system.\n\n");\r
+> +- usage ();\r
+> ++ fprintf (stdout, "The notmuch mail system.\n\n");\r
+> ++ usage (stdout);\r
+> + return 0;\r
+> + }\r
+> +[ application/pgp-signature ]\r
+> +[ text/plain ]\r
+> +[ 4-line signature. Click/Enter to show. ]\r
+> + Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-18) (attachment inbox signed)\r
+> -- \r
+> 1.8.5.2.8.g0f6c0d1\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r