Re: [PATCH 0/4] Allow specifying alternate names for addresses in other_email
[notmuch-archives.git] / 63 / 8530b6255e70bbd7c0d43599525eb8782ed716
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 C43AF431FB6\r
6         for <notmuch@notmuchmail.org>; Sat, 17 Mar 2012 09:51:23 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \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 NvAj79+wpn3Q for <notmuch@notmuchmail.org>;\r
16         Sat, 17 Mar 2012 09:51:23 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-5.mit.edu (DMZ-MAILSEC-SCANNER-5.MIT.EDU\r
18         [18.7.68.34])\r
19         by olra.theworths.org (Postfix) with ESMTP id DA6D2431FAE\r
20         for <notmuch@notmuchmail.org>; Sat, 17 Mar 2012 09:51:22 -0700 (PDT)\r
21 X-AuditID: 12074422-b7fd66d0000008f9-d3-4f64c10a1ec3\r
22 Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])\r
23         by dmz-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id 03.7B.02297.A01C46F4; Sat, 17 Mar 2012 12:51:22 -0400 (EDT)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id q2HGpLmA013802; \r
27         Sat, 17 Mar 2012 12:51:22 -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 q2HGpKaZ012098\r
32         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
33         Sat, 17 Mar 2012 12:51:21 -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 1S8wqe-000476-95; Sat, 17 Mar 2012 12:51:20 -0400\r
37 Date: Sat, 17 Mar 2012 12:51:20 -0400\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: Mark Walters <markwalters1009@gmail.com>\r
40 Subject: Re: [PATCH 4/5] cli: move show to the new --exclude= option naming\r
41         scheme.\r
42 Message-ID: <20120317165119.GI2670@mit.edu>\r
43 References: <1331836925-31437-1-git-send-email-markwalters1009@gmail.com>\r
44         <1331836925-31437-5-git-send-email-markwalters1009@gmail.com>\r
45 MIME-Version: 1.0\r
46 Content-Type: text/plain; charset=us-ascii\r
47 Content-Disposition: inline\r
48 In-Reply-To: <1331836925-31437-5-git-send-email-markwalters1009@gmail.com>\r
49 User-Agent: Mutt/1.5.21 (2010-09-15)\r
50 X-Brightmail-Tracker:\r
51  H4sIAAAAAAAAA+NgFupjleLIzCtJLcpLzFFi42IR4hRV1uU6mOJvsP6psMXquTwW12/OZHZg\r
52         8tg56y67x7NVt5gDmKK4bFJSczLLUov07RK4MuZ/6GUv2GRTsfNCJ2MD4z/dLkZODgkBE4lF\r
53         29cyQdhiEhfurWfrYuTiEBLYxyhxqOE0C4SzgVHi8s11zBDOSSaJUy2boDJLGCWmfpnHBtLP\r
54         IqAqcWzBQrBZbAIaEtv2L2cEsUUEdCRuH1rADmIzC0hLfPvdDFYjLBAq0fZuHVAvBwevgLbE\r
55         jCYxiJmdjBK33k0Cq+cVEJQ4OfMJC0SvlsSNfy+ZQOpB5iz/xwFicgp4SUz9oAJSISqgIjHl\r
56         5Da2CYxCs5A0z0LSPAuheQEj8ypG2ZTcKt3cxMyc4tRk3eLkxLy81CJdU73czBK91JTSTYyg\r
57         oGZ3UdrB+POg0iFGAQ5GJR5ejgnJ/kKsiWXFlbmHGCU5mJREeRkPpPgL8SXlp1RmJBZnxBeV\r
58         5qQWH2KU4GBWEuGVWg6U401JrKxKLcqHSUlzsCiJ86prvfMTEkhPLEnNTk0tSC2CycpwcChJ\r
59         8PqADBUsSk1PrUjLzClBSDNxcIIM5wEa7gpSw1tckJhbnJkOkT/FqMvRPfXRJUYhlrz8vFQp\r
60         cV5TkCIBkKKM0jy4ObBk9IpRHOgtYd44kCoeYCKDm/QKaAkT0JKZZckgS0oSEVJSDYyzV7Ww\r
61         S+zQmG2l03jspfwURdt/Ag4h+yas/XL1C7vL/wd6ddrBS65dNudp55fkLefdqz/h69WXQW8M\r
62         BCYIZH640vVxmbWW7ZxFe0IuzLrqdIY7Iv7UyStOrS9XfTWNWyW9+LDXbe+cnwvfr4rcmH7g\r
63         nWmABHtb8pRszRtSCl1skXe51/WlP9ukxFKckWioxVxUnAgAFMAwgCEDAAA=\r
64 Cc: notmuch@notmuchmail.org\r
65 X-BeenThere: notmuch@notmuchmail.org\r
66 X-Mailman-Version: 2.1.13\r
67 Precedence: list\r
68 List-Id: "Use and development of the notmuch mail system."\r
69         <notmuch.notmuchmail.org>\r
70 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
71         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
72 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
73 List-Post: <mailto:notmuch@notmuchmail.org>\r
74 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
75 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
76         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
77 X-List-Received-Date: Sat, 17 Mar 2012 16:51:23 -0000\r
78 \r
79 Quoth Mark Walters on Mar 15 at  6:42 pm:\r
80 > This moves show to the --exclude=(true|false|flag) naming\r
81 > scheme. When `exclude' is false or flag show returns all threads\r
82 > that match including those that only match in an excluded message, the\r
83 > difference being whether excluded messages are flagged excluded.\r
84\r
85 > When exclude=true the behaviour depends on whether --entire-threads\r
86 \r
87 s/--entire-threads/--entire-thread/\r
88 \r
89 > is set. If it is not set then show only returns the messages which\r
90 > match and are not excluded. If it is set then show returns all\r
91 > messages in these threads flagging the excluded messages. The\r
92 \r
93 Parse error.\r
94 \r
95 > rationale is that it is awkward to use a thread with some missing\r
96 > messages.\r
97 > ---\r
98 >  man/man1/notmuch-show.1 |   16 ++++++++++++++--\r
99 >  notmuch-client.h        |    1 +\r
100 >  notmuch-show.c          |   39 +++++++++++++++++++++++++++++----------\r
101 >  3 files changed, 44 insertions(+), 12 deletions(-)\r
102\r
103 > diff --git a/man/man1/notmuch-show.1 b/man/man1/notmuch-show.1\r
104 > index d75d971..801b7f1 100644\r
105 > --- a/man/man1/notmuch-show.1\r
106 > +++ b/man/man1/notmuch-show.1\r
107 > @@ -130,9 +130,21 @@ content.\r
108 >  \r
109 >  .RS 4\r
110 >  .TP 4\r
111 > -.B \-\-no-exclude\r
112 > +.BR \-\-exclude=(true|false|flag)\r
113 > +\r
114 > +Specify whether to omit threads only matching search.tag_exclude from\r
115 > +the search results (the default) or not. The extra option\r
116 > +.B flag\r
117 > +includes these messages but marks them with the excluded flag.\r
118 > +\r
119 > +If --entire-thread is specified then complete threads are returned\r
120 > +regardless (with the excluded flag being set when appropriate) but\r
121 > +threads that only match in an excluded message are not returned when\r
122 > +.B --exclude=true.\r
123 \r
124 I found this a bit confusing.  There are two orthogonal things going\r
125 on here: what happens to excluded messages and what happens to\r
126 fully-excluded threads.  Is the following table accurate?\r
127 \r
128          --entire-thread=false\r
129       excl. messages   excl. threads\r
130 true       omit            omit\r
131 false    include         include\r
132 flag   include,flag      include\r
133 \r
134          --entire-thread=true\r
135       excl. messages   excl. threads\r
136 true   include,flag        omit\r
137 false    include         include\r
138 flag   include,flag      include\r
139 \r
140 (My reasoning: --exclude=false is equivalent to not having any\r
141 excludes configured, --exclude=true omits excluded messages from the\r
142 seed set and filters them in show_messages, --exclude=flag does not\r
143 exclude messages from the seed set nor filter them in show_messages.)\r
144 \r
145 If this is right, then what's the point of having both false and flag\r
146 for show?  I'm pretty sure their performance will be\r
147 indistinguishable.\r
148 \r
149 > +\r
150 > +The default is\r
151 > +.B --exclude=true.\r
152 >  \r
153 > -Do not exclude the messages matching search.exclude_tags in the config file.\r
154 >  .RE\r
155 >  \r
156 >  A common use of\r
157 > diff --git a/notmuch-client.h b/notmuch-client.h\r
158 > index f4a62cc..e36148b 100644\r
159 > --- a/notmuch-client.h\r
160 > +++ b/notmuch-client.h\r
161 > @@ -99,6 +99,7 @@ typedef struct notmuch_show_format {\r
162 >  \r
163 >  typedef struct notmuch_show_params {\r
164 >      notmuch_bool_t entire_thread;\r
165 > +    notmuch_bool_t omit_excluded;\r
166 >      notmuch_bool_t raw;\r
167 >      int part;\r
168 >  #ifdef GMIME_ATLEAST_26\r
169 > diff --git a/notmuch-show.c b/notmuch-show.c\r
170 > index 05d51b2..20d6635 100644\r
171 > --- a/notmuch-show.c\r
172 > +++ b/notmuch-show.c\r
173 > @@ -812,6 +812,7 @@ show_messages (void *ctx,\r
174 >  {\r
175 >      notmuch_message_t *message;\r
176 >      notmuch_bool_t match;\r
177 > +    notmuch_bool_t excluded;\r
178 >      int first_set = 1;\r
179 >      int next_indent;\r
180 >  \r
181 > @@ -830,10 +831,11 @@ show_messages (void *ctx,\r
182 >       message = notmuch_messages_get (messages);\r
183 >  \r
184 >       match = notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH);\r
185 > +     excluded = notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED);\r
186 >  \r
187 >       next_indent = indent;\r
188 >  \r
189 > -     if (match || params->entire_thread) {\r
190 > +     if ((match && (!excluded || !params->omit_excluded)) || params->entire_thread) {\r
191 >           show_message (ctx, format, message, indent, params);\r
192 >           next_indent = indent + 1;\r
193 >  \r
194 > @@ -974,6 +976,12 @@ enum {\r
195 >      NOTMUCH_FORMAT_RAW\r
196 >  };\r
197 >  \r
198 > +enum {\r
199 > +    EXCLUDE_TRUE,\r
200 > +    EXCLUDE_FALSE,\r
201 > +    EXCLUDE_FLAG,\r
202 > +};\r
203 > +\r
204 >  int\r
205 >  notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
206 >  {\r
207 > @@ -983,10 +991,10 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
208 >      char *query_string;\r
209 >      int opt_index, ret;\r
210 >      const notmuch_show_format_t *format = &format_text;\r
211 > -    notmuch_show_params_t params = { .part = -1 };\r
212 > +    notmuch_show_params_t params = { .part = -1, .omit_excluded = TRUE };\r
213 >      int format_sel = NOTMUCH_FORMAT_NOT_SPECIFIED;\r
214 >      notmuch_bool_t verify = FALSE;\r
215 > -    notmuch_bool_t no_exclude = FALSE;\r
216 > +    int exclude = EXCLUDE_TRUE;\r
217 >  \r
218 >      notmuch_opt_desc_t options[] = {\r
219 >       { NOTMUCH_OPT_KEYWORD, &format_sel, "format", 'f',\r
220 > @@ -995,11 +1003,15 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
221 >                                 { "mbox", NOTMUCH_FORMAT_MBOX },\r
222 >                                 { "raw", NOTMUCH_FORMAT_RAW },\r
223 >                                 { 0, 0 } } },\r
224 > +        { NOTMUCH_OPT_KEYWORD, &exclude, "exclude", 'x',\r
225 > +          (notmuch_keyword_t []){ { "true", EXCLUDE_TRUE },\r
226 > +                                  { "false", EXCLUDE_FALSE },\r
227 > +                                  { "flag", EXCLUDE_FLAG },\r
228 > +                                  { 0, 0 } } },\r
229 >       { NOTMUCH_OPT_INT, &params.part, "part", 'p', 0 },\r
230 >       { NOTMUCH_OPT_BOOLEAN, &params.entire_thread, "entire-thread", 't', 0 },\r
231 >       { NOTMUCH_OPT_BOOLEAN, &params.decrypt, "decrypt", 'd', 0 },\r
232 >       { NOTMUCH_OPT_BOOLEAN, &verify, "verify", 'v', 0 },\r
233 > -     { NOTMUCH_OPT_BOOLEAN, &no_exclude, "no-exclude", 'n', 0 },\r
234 >       { 0, 0, 0, 0, 0 }\r
235 >      };\r
236 >  \r
237 > @@ -1088,16 +1100,18 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
238 >       return 1;\r
239 >      }\r
240 >  \r
241 > -    /* if format=mbox then we can not output excluded messages as\r
242 > -     * there is no way to make the exclude flag available */\r
243 > -    if (format_sel == NOTMUCH_FORMAT_MBOX)\r
244 > -     notmuch_query_set_omit_excluded_messages (query, TRUE);\r
245 > -\r
246 >      /* If a single message is requested we do not use search_excludes. */\r
247 >      if (params.part >= 0)\r
248 >       ret = do_show_single (ctx, query, format, &params);\r
249 >      else {\r
250 > -     if (!no_exclude) {\r
251 > +     if (format == &format_mbox && exclude == EXCLUDE_FLAG) {\r
252 > +         /* there is no where to mark flagged messages so fall back on\r
253 \r
254 s/no where/nowhere/  Also, s/there/There/ for style consistency.\r
255 \r
256 > +          * including the excluded messages */\r
257 > +         fprintf (stderr, "Cannot flag excluded messages with format=mbox: fall back on just including them\n");\r
258 \r
259 This is a bit verbose.  How about just "Warning: mbox cannot flag\r
260 excluded messages"?  Flag already means that the messages should be\r
261 included, so this message states exactly what mbox isn't doing that\r
262 you might expect it to.\r
263 \r
264 > +         exclude = EXCLUDE_FALSE;\r
265 > +     }\r
266 > +\r
267 > +     if (exclude != EXCLUDE_FALSE) {\r
268 >           const char **search_exclude_tags;\r
269 >           size_t search_exclude_tags_length;\r
270 >           unsigned int i;\r
271 > @@ -1106,7 +1120,12 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
272 >               (config, &search_exclude_tags_length);\r
273 >           for (i = 0; i < search_exclude_tags_length; i++)\r
274 >               notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);\r
275 > +         if (exclude == EXCLUDE_FLAG) {\r
276 > +             notmuch_query_set_omit_excluded_messages(query, FALSE);\r
277 > +             params.omit_excluded = FALSE;\r
278 > +         }\r
279 >       }\r
280 > +\r
281 >       ret = do_show (ctx, query, format, &params);\r
282 >      }\r
283 >  \r