1 Return-Path: <wuzzeb@wuzzeb.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 olra.theworths.org (Postfix) with ESMTP id A87DC431FCF
\r
6 for <notmuch@notmuchmail.org>; Mon, 1 Jul 2013 17:19:52 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_NONE=-0.0001] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id QGG4L3nO6QAs for <notmuch@notmuchmail.org>;
\r
16 Mon, 1 Jul 2013 17:19:45 -0700 (PDT)
\r
17 Received: from smtp.rcn.com (smtp.rcn.com [69.168.97.78])
\r
18 by olra.theworths.org (Postfix) with ESMTP id 1AF50431FC7
\r
19 for <notmuch@notmuchmail.org>; Mon, 1 Jul 2013 17:19:45 -0700 (PDT)
\r
20 X_CMAE_Category: 0,0 Undefined,Undefined
\r
21 X-CNFS-Analysis: v=2.1 cv=IKk7VGfG c=1 sm=0 tr=0
\r
22 a=C2bPeGdon5f+QfTtoGFpIg==:117 a=L41ukIAEf44A:10
\r
23 a=97V-WqMTq8EA:10 a=IkcTkHD0fZMA:10 a=3wHbS4G-AAAA:8
\r
24 a=7343-z1_AAAA:8 a=pm0CvZHm5i0A:10 a=K-m1EemV6aEvyrkEG1UA:9
\r
27 X-Scanned-by: Cloudmark Authority Engine
\r
28 Authentication-Results: smtp01.rcn.cmh.synacor.com
\r
29 smtp.mail=wuzzeb@wuzzeb.org; spf=pass; sender-id=pass
\r
30 Authentication-Results: smtp01.rcn.cmh.synacor.com
\r
31 header.from=wuzzeb@wuzzeb.org; sender-id=pass
\r
32 Received-SPF: pass (smtp01.rcn.cmh.synacor.com: domain wuzzeb.org designates
\r
33 205.178.10.182 as permitted sender)
\r
34 Received: from [205.178.10.182] ([205.178.10.182:45556] helo=wuzzeb.org)
\r
35 by smtp.rcn.com (envelope-from <wuzzeb@wuzzeb.org>)
\r
36 (ecelerity 2.2.3.49 r(42060/42061)) with ESMTP
\r
37 id 17/7B-12322-F9C12D15; Mon, 01 Jul 2013 20:19:43 -0400
\r
38 Received: from wuzzeb by wuzzeb.org with local (Exim 4.80.1)
\r
39 (envelope-from <wuzzeb@wuzzeb.org>) id 1UtoJq-0000IK-Qa
\r
40 for notmuch@notmuchmail.org; Mon, 01 Jul 2013 19:19:43 -0500
\r
41 From: =?utf-8?Q?John_Lenz?= <lenz@math.uic.edu>
\r
42 To: <notmuch@notmuchmail.org>
\r
43 Subject: cli: add --include-html option to notmuch show
\r
44 Message-ID: <notmuch-web-1372724382.450184839@www.wuzzeb.org>
\r
46 Content-Type: text/plain; charset=UTF-8
\r
47 Sender: <wuzzeb@wuzzeb.org>
\r
48 Date: Mon, 01 Jul 2013 19:19:42 -0500
\r
49 X-BeenThere: notmuch@notmuchmail.org
\r
50 X-Mailman-Version: 2.1.13
\r
52 List-Id: "Use and development of the notmuch mail system."
\r
53 <notmuch.notmuchmail.org>
\r
54 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
55 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
56 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
57 List-Post: <mailto:notmuch@notmuchmail.org>
\r
58 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
59 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
60 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
61 X-List-Received-Date: Tue, 02 Jul 2013 00:19:52 -0000
\r
63 For my client, the largest bottleneck for displaying large threads is
\r
64 exporting each html part individually since by default notmuch will not
\r
65 show the json parts. For large threads there can be quite a few parts and
\r
66 each must be exported and decoded one by one. Also, I then have to deal
\r
67 with all the crazy charsets which I can do through a library but is a
\r
70 Therefore, this patch adds an --include-html option that causes the
\r
71 text/html parts to be included as part of the output of show.
\r
74 diff man/man1/notmuch-show.1
\r
75 --- a/man/man1/notmuch-show.1 Sun Jun 23 14:24:02 2013 +1000
\r
76 +++ b/man/man1/notmuch-show.1 Mon Jul 01 18:51:13 2013 -0500
\r
77 @@ -207,6 +207,20 @@
\r
78 output is much faster and substantially smaller.
\r
83 +.B \-\-include-html
\r
85 +Include "text/html" parts as part of the output (currently only supported with
\r
86 +--format=json and --format=sexp).
\r
89 +is used to select a specific part or
\r
91 +is used to include all "text/html" parts, no part with content type "text/html"
\r
92 +is included in the output.
\r
97 is to display a single thread of email messages. For this, use a
\r
98 diff notmuch-client.h
\r
99 --- a/notmuch-client.h Sun Jun 23 14:24:02 2013 +1000
\r
100 +++ b/notmuch-client.h Mon Jul 01 18:51:13 2013 -0500
\r
102 notmuch_bool_t raw;
\r
104 notmuch_crypto_t crypto;
\r
105 + notmuch_bool_t include_html;
\r
106 } notmuch_show_params_t;
\r
108 /* There's no point in continuing when we've detected that we've done
\r
109 @@ -220,7 +221,8 @@
\r
112 format_part_sprinter (const void *ctx, struct sprinter *sp, mime_node_t *node,
\r
113 - notmuch_bool_t first, notmuch_bool_t output_body);
\r
114 + notmuch_bool_t first, notmuch_bool_t output_body,
\r
115 + notmuch_bool_t include_html);
\r
118 format_headers_sprinter (struct sprinter *sp, GMimeMessage *message,
\r
119 diff notmuch-reply.c
\r
120 --- a/notmuch-reply.c Sun Jun 23 14:24:02 2013 +1000
\r
121 +++ b/notmuch-reply.c Mon Jul 01 18:51:13 2013 -0500
\r
122 @@ -624,7 +624,7 @@
\r
124 /* Start the original */
\r
125 sp->map_key (sp, "original");
\r
126 - format_part_sprinter (ctx, sp, node, TRUE, TRUE);
\r
127 + format_part_sprinter (ctx, sp, node, TRUE, TRUE, FALSE);
\r
131 diff notmuch-show.c
\r
132 --- a/notmuch-show.c Sun Jun 23 14:24:02 2013 +1000
\r
133 +++ b/notmuch-show.c Mon Jul 01 18:51:13 2013 -0500
\r
134 @@ -630,7 +630,8 @@
\r
137 format_part_sprinter (const void *ctx, sprinter_t *sp, mime_node_t *node,
\r
138 - notmuch_bool_t first, notmuch_bool_t output_body)
\r
139 + notmuch_bool_t first, notmuch_bool_t output_body,
\r
140 + notmuch_bool_t include_html)
\r
142 /* Any changes to the JSON or S-Expression format should be
\r
143 * reflected in the file devel/schemata. */
\r
144 @@ -645,7 +646,7 @@
\r
146 sp->map_key (sp, "body");
\r
147 sp->begin_list (sp);
\r
148 - format_part_sprinter (ctx, sp, mime_node_child (node, 0), first, TRUE);
\r
149 + format_part_sprinter (ctx, sp, mime_node_child (node, 0), first, TRUE, include_html);
\r
153 @@ -700,14 +701,15 @@
\r
154 /* For non-HTML text parts, we include the content in the
\r
155 * JSON. Since JSON must be Unicode, we handle charset
\r
156 * decoding here and do not report a charset to the caller.
\r
157 - * For text/html parts, we do not include the content. If a
\r
158 - * caller is interested in text/html parts, it should retrieve
\r
159 - * them separately and they will not be decoded. Since this
\r
160 - * makes charset decoding the responsibility on the caller, we
\r
161 + * For text/html parts, we do not include the content unless
\r
162 + * the --include-html option has been passed. If a html part
\r
163 + * is not included, it can be requested directly. This makes
\r
164 + * charset decoding the responsibility on the caller so we
\r
165 * report the charset for text/html parts.
\r
167 if (g_mime_content_type_is_type (content_type, "text", "*") &&
\r
168 - ! g_mime_content_type_is_type (content_type, "text", "html"))
\r
170 + ! g_mime_content_type_is_type (content_type, "text", "html")))
\r
172 GMimeStream *stream_memory = g_mime_stream_mem_new ();
\r
173 GByteArray *part_content;
\r
174 @@ -737,7 +739,7 @@
\r
177 for (i = 0; i < node->nchildren; i++)
\r
178 - format_part_sprinter (ctx, sp, mime_node_child (node, i), i == 0, TRUE);
\r
179 + format_part_sprinter (ctx, sp, mime_node_child (node, i), i == 0, TRUE, include_html);
\r
181 /* Close content structures */
\r
182 for (i = 0; i < nclose; i++)
\r
183 @@ -751,7 +753,7 @@
\r
184 mime_node_t *node, unused (int indent),
\r
185 const notmuch_show_params_t *params)
\r
187 - format_part_sprinter (ctx, sp, node, TRUE, params->output_body);
\r
188 + format_part_sprinter (ctx, sp, node, TRUE, params->output_body, params->include_html);
\r
190 return NOTMUCH_STATUS_SUCCESS;
\r
192 @@ -1077,7 +1079,8 @@
\r
198 + .include_html = FALSE
\r
200 int format_sel = NOTMUCH_FORMAT_NOT_SPECIFIED;
\r
201 int exclude = EXCLUDE_TRUE;
\r
202 @@ -1105,6 +1108,7 @@
\r
203 { NOTMUCH_OPT_BOOLEAN, ¶ms.crypto.decrypt, "decrypt", 'd', 0 },
\r
204 { NOTMUCH_OPT_BOOLEAN, ¶ms.crypto.verify, "verify", 'v', 0 },
\r
205 { NOTMUCH_OPT_BOOLEAN, ¶ms.output_body, "body", 'b', 0 },
\r
206 + { NOTMUCH_OPT_BOOLEAN, ¶ms.include_html, "include-html", 0, 0 },
\r
210 @@ -1176,6 +1180,11 @@
\r
214 + if (params.include_html &&
\r
215 + (format_sel != NOTMUCH_FORMAT_JSON && format_sel != NOTMUCH_FORMAT_SEXP)) {
\r
216 + fprintf (stderr, "Warning: --include-html only implemented for format=json and format=sexp\n");
\r
219 if (entire_thread == ENTIRE_THREAD_TRUE)
\r
220 params.entire_thread = TRUE;
\r