1 Return-Path: <amdragon@mit.edu>
\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 BBBAB431FAF
\r
6 for <notmuch@notmuchmail.org>; Mon, 23 Jul 2012 09:43:57 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 R4TRyH-Cwbkz for <notmuch@notmuchmail.org>;
\r
16 Mon, 23 Jul 2012 09:43:56 -0700 (PDT)
\r
17 Received: from dmz-mailsec-scanner-4.mit.edu (DMZ-MAILSEC-SCANNER-4.MIT.EDU
\r
19 by olra.theworths.org (Postfix) with ESMTP id 2CC6C431FAE
\r
20 for <notmuch@notmuchmail.org>; Mon, 23 Jul 2012 09:43:56 -0700 (PDT)
\r
21 X-AuditID: 1209190f-b7f306d0000008b4-50-500d7f4babb3
\r
22 Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])
\r
23 by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id 30.D1.02228.B4F7D005; Mon, 23 Jul 2012 12:43:55 -0400 (EDT)
\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])
\r
26 by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id q6NGhs9O020707;
\r
27 Mon, 23 Jul 2012 12:43:55 -0400
\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])
\r
29 (authenticated bits=0)
\r
30 (User authenticated as amdragon@ATHENA.MIT.EDU)
\r
31 by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q6NGhrAW020709
\r
32 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);
\r
33 Mon, 23 Jul 2012 12:43:54 -0400 (EDT)
\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)
\r
35 (envelope-from <amdragon@mit.edu>)
\r
36 id 1StLjd-0002fa-LA; Mon, 23 Jul 2012 12:43:53 -0400
\r
37 Date: Mon, 23 Jul 2012 12:43:53 -0400
\r
38 From: Austin Clements <amdragon@MIT.EDU>
\r
39 To: Mark Walters <markwalters1009@gmail.com>
\r
40 Subject: Re: [PATCH 1/4] cli: add --body=true|false option to notmuch-show.c
\r
41 Message-ID: <20120723164353.GG31834@mit.edu>
\r
42 References: <1343060241-18283-1-git-send-email-markwalters1009@gmail.com>
\r
43 <1343060241-18283-2-git-send-email-markwalters1009@gmail.com>
\r
45 Content-Type: text/plain; charset=us-ascii
\r
46 Content-Disposition: inline
\r
47 In-Reply-To: <1343060241-18283-2-git-send-email-markwalters1009@gmail.com>
\r
48 User-Agent: Mutt/1.5.21 (2010-09-15)
\r
49 X-Brightmail-Tracker:
\r
50 H4sIAAAAAAAAA+NgFmpileLIzCtJLcpLzFFi42IR4hTV1vWu5w0weNKsbrF6Lo/F9ZszmR2Y
\r
51 PHbOusvu8WzVLeYApigum5TUnMyy1CJ9uwSujMvt99kKXqhVvJ39l6WBcYtcFyMnh4SAicT3
\r
52 uQtZIGwxiQv31rN1MXJxCAnsY5T4Mf82M4SzgVFi864FLBDOSSaJWe/2sUI4SxglOrZPZ+9i
\r
53 5OBgEVCVaDjEDzKKTUBDYtv+5YwgtoiAjsTtQwvYQWxmAWmJb7+bmUBsYQEfiQWLv7CBtPIC
\r
54 1ey5xgMxspNRoufmf2aQGl4BQYmTM5+wQPRqSdz495IJpB5kzvJ/HCBhTgEvieOzfoGViwqo
\r
55 SEw5uY1tAqPQLCTds5B0z0LoXsDIvIpRNiW3Sjc3MTOnODVZtzg5MS8vtUjXRC83s0QvNaV0
\r
56 EyM4qCX5dzB+O6h0iFGAg1GJh9eqiidAiDWxrLgy9xCjJAeTkiivaAVvgBBfUn5KZUZicUZ8
\r
57 UWlOavEhRgkOZiUR3tXVQDnelMTKqtSifJiUNAeLkjjv1ZSb/kIC6YklqdmpqQWpRTBZGQ4O
\r
58 JQle3TqgRsGi1PTUirTMnBKENBMHJ8hwHqDh3iA1vMUFibnFmekQ+VOMilLivFIgCQGQREZp
\r
59 HlwvLOm8YhQHekWYNw6kigeYsOC6XwENZgIaLJ3FBTK4JBEhJdXAGG1/WzZ7t9T3aZ8lF+/8
\r
60 f+1LTsE58x7/8sazH1qfbfbUjC0vXLzEs0nJpKdUlvnPHR/GcGvvcgeGSJvky1aaHeEf1f7m
\r
61 yVamL/3+8AzrRn7HvewHu0I/pK42/rHp4wYrnh9ZGp21bfMOmO/iF0jM6+pXnDjnctHytQUp
\r
62 J//O4ecoKWCJDa9TYinOSDTUYi4qTgQA68HV0BUDAAA=
\r
63 Cc: notmuch@notmuchmail.org
\r
64 X-BeenThere: notmuch@notmuchmail.org
\r
65 X-Mailman-Version: 2.1.13
\r
67 List-Id: "Use and development of the notmuch mail system."
\r
68 <notmuch.notmuchmail.org>
\r
69 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
70 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
71 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
72 List-Post: <mailto:notmuch@notmuchmail.org>
\r
73 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
74 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
75 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
76 X-List-Received-Date: Mon, 23 Jul 2012 16:43:57 -0000
\r
78 Quoth Mark Walters on Jul 23 at 5:17 pm:
\r
79 > This option allows the caller to suppress the output of the bodies of
\r
80 > the messages. Currently this is only implemented for format=json.
\r
82 > This is used by notmuch-pick.el (although not needed) because it gives
\r
83 > a speed-up of at least a factor of a two (and in some cases a speed up
\r
84 > of more than a factor of 8); moreover it reduces the memory usage in
\r
87 > notmuch-client.h | 3 ++-
\r
88 > notmuch-reply.c | 2 +-
\r
89 > notmuch-show.c | 23 +++++++++++++++--------
\r
90 > 3 files changed, 18 insertions(+), 10 deletions(-)
\r
92 > diff --git a/notmuch-client.h b/notmuch-client.h
\r
93 > index 0c17b79..f930798 100644
\r
94 > --- a/notmuch-client.h
\r
95 > +++ b/notmuch-client.h
\r
96 > @@ -87,6 +87,7 @@ typedef struct notmuch_crypto {
\r
97 > typedef struct notmuch_show_params {
\r
98 > notmuch_bool_t entire_thread;
\r
99 > notmuch_bool_t omit_excluded;
\r
100 > + notmuch_bool_t output_body;
\r
101 > notmuch_bool_t raw;
\r
103 > notmuch_crypto_t crypto;
\r
104 > @@ -176,7 +177,7 @@ notmuch_status_t
\r
105 > show_one_part (const char *filename, int part);
\r
108 > -format_part_json (const void *ctx, mime_node_t *node, notmuch_bool_t first);
\r
109 > +format_part_json (const void *ctx, mime_node_t *node, notmuch_bool_t first, notmuch_bool_t output_body);
\r
112 > format_headers_json (const void *ctx, GMimeMessage *message, notmuch_bool_t reply);
\r
113 > diff --git a/notmuch-reply.c b/notmuch-reply.c
\r
114 > index 3a038ed..de21f3b 100644
\r
115 > --- a/notmuch-reply.c
\r
116 > +++ b/notmuch-reply.c
\r
117 > @@ -620,7 +620,7 @@ notmuch_reply_format_json(void *ctx,
\r
118 > /* Start the original */
\r
119 > printf (", \"original\": ");
\r
121 > - format_part_json (ctx, node, TRUE);
\r
122 > + format_part_json (ctx, node, TRUE, TRUE);
\r
126 > diff --git a/notmuch-show.c b/notmuch-show.c
\r
127 > index 8f3c60e..c2ad4fb 100644
\r
128 > --- a/notmuch-show.c
\r
129 > +++ b/notmuch-show.c
\r
130 > @@ -559,7 +559,7 @@ format_part_text (const void *ctx, mime_node_t *node,
\r
134 > -format_part_json (const void *ctx, mime_node_t *node, notmuch_bool_t first)
\r
135 > +format_part_json (const void *ctx, mime_node_t *node, notmuch_bool_t first, notmuch_bool_t output_body)
\r
137 > /* Any changes to the JSON format should be reflected in the file
\r
138 > * devel/schemata. */
\r
139 > @@ -571,10 +571,12 @@ format_part_json (const void *ctx, mime_node_t *node, notmuch_bool_t first)
\r
140 > printf ("\"headers\": ");
\r
141 > format_headers_json (ctx, GMIME_MESSAGE (node->part), FALSE);
\r
143 > - printf (", \"body\": [");
\r
144 > - format_part_json (ctx, mime_node_child (node, 0), first);
\r
147 > + if (output_body) {
\r
148 > + printf (", \"body\": [");
\r
149 > + format_part_json (ctx, mime_node_child (node, 0), first, TRUE);
\r
156 > @@ -652,16 +654,16 @@ format_part_json (const void *ctx, mime_node_t *node, notmuch_bool_t first)
\r
157 > talloc_free (local);
\r
159 > for (i = 0; i < node->nchildren; i++)
\r
160 > - format_part_json (ctx, mime_node_child (node, i), i == 0);
\r
161 > + format_part_json (ctx, mime_node_child (node, i), i == 0, TRUE);
\r
163 > printf ("%s}", terminator);
\r
166 > static notmuch_status_t
\r
167 > format_part_json_entry (const void *ctx, mime_node_t *node, unused (int indent),
\r
168 > - unused (const notmuch_show_params_t *params))
\r
169 > + const notmuch_show_params_t *params)
\r
171 > - format_part_json (ctx, node, TRUE);
\r
172 > + format_part_json (ctx, node, TRUE, params->output_body);
\r
174 > return NOTMUCH_STATUS_SUCCESS;
\r
176 > @@ -1004,6 +1006,7 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
\r
177 > notmuch_show_params_t params = {
\r
179 > .omit_excluded = TRUE,
\r
180 > + .output_body = TRUE,
\r
184 > @@ -1032,6 +1035,7 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
\r
185 > { NOTMUCH_OPT_INT, ¶ms.part, "part", 'p', 0 },
\r
186 > { NOTMUCH_OPT_BOOLEAN, ¶ms.crypto.decrypt, "decrypt", 'd', 0 },
\r
187 > { NOTMUCH_OPT_BOOLEAN, ¶ms.crypto.verify, "verify", 'v', 0 },
\r
188 > + { NOTMUCH_OPT_BOOLEAN, ¶ms.output_body, "body", 'h', 0 },
\r
190 Why 'h' for the short option?
\r
192 > { 0, 0, 0, 0, 0 }
\r
195 > @@ -1086,6 +1090,9 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
\r
196 > entire_thread = ENTIRE_THREAD_FALSE;
\r
199 > + if (!params.output_body && format != &format_json)
\r
200 > + fprintf (stderr,"Warning: --body=false only implemented for format=json\n");
\r
202 Missing space after comma.
\r
204 Should we consider how --part and --body interact? Maybe specifying
\r
205 --part is incompatible with --body=false? Or specifying a part > 0 is
\r
206 incompatible with --body=false?
\r
209 > if (entire_thread == ENTIRE_THREAD_TRUE)
\r
210 > params.entire_thread = TRUE;
\r