[PATCH 1/2] emacs: wash: word-wrap bugfix
[notmuch-archives.git] / 86 / 82ddcea06ec2dfc3bfa0c3a5d2334fac75d923
1 Return-Path: <m.walters@qmul.ac.uk>\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 61B50431FB6\r
6         for <notmuch@notmuchmail.org>; Sun, 18 Mar 2012 10:30:30 -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: -1.098\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
12         tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
13         NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id QZdCY3eVJojM for <notmuch@notmuchmail.org>;\r
17         Sun, 18 Mar 2012 10:30:29 -0700 (PDT)\r
18 Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
19         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 36B53431FAF\r
22         for <notmuch@notmuchmail.org>; Sun, 18 Mar 2012 10:30:29 -0700 (PDT)\r
23 Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
24         by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
25         (envelope-from <m.walters@qmul.ac.uk>)\r
26         id 1S9Jvy-00057l-Nn; Sun, 18 Mar 2012 17:30:25 +0000\r
27 Received: from 94-192-233-223.zone6.bethere.co.uk ([94.192.233.223]\r
28         helo=localhost)\r
29         by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69)\r
30         (envelope-from <m.walters@qmul.ac.uk>)\r
31         id 1S9Jvy-0006EJ-7R; Sun, 18 Mar 2012 17:30:22 +0000\r
32 From: Mark Walters <markwalters1009@gmail.com>\r
33 To: Austin Clements <amdragon@MIT.EDU>\r
34 Subject: Re: [PATCH 4/5] cli: move show to the new --exclude= option naming\r
35         scheme.\r
36 In-Reply-To: <20120317165119.GI2670@mit.edu>\r
37 References: <1331836925-31437-1-git-send-email-markwalters1009@gmail.com>\r
38         <1331836925-31437-5-git-send-email-markwalters1009@gmail.com>\r
39         <20120317165119.GI2670@mit.edu>\r
40 User-Agent: Notmuch/0.11.1+302~g99b9184 (http://notmuchmail.org) Emacs/23.3.1\r
41         (x86_64-pc-linux-gnu)\r
42 Warning: No xauth data; using fake authentication data for X11 forwarding.\r
43 Date: Sun, 18 Mar 2012 17:30:31 +0000\r
44 Message-ID: <87aa3dhl54.fsf@qmul.ac.uk>\r
45 MIME-Version: 1.0\r
46 Content-Type: text/plain; charset=us-ascii\r
47 X-Sender-Host-Address: 94.192.233.223\r
48 X-QM-SPAM-Info: Sender has good ham record.  :)\r
49 X-QM-Body-MD5: 13f51f946ee8ad6adefe67e26ef17091 (of first 20000 bytes)\r
50 X-SpamAssassin-Score: -1.8\r
51 X-SpamAssassin-SpamBar: -\r
52 X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
53         determine if it is\r
54         spam. We require at least 5.0 points to mark a message as spam.\r
55         This message scored -1.8 points.\r
56         Summary of the scoring: \r
57         * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,\r
58         *      medium trust\r
59         *      [138.37.6.40 listed in list.dnswl.org]\r
60         * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
61         provider *      (markwalters1009[at]gmail.com)\r
62         * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay\r
63         *      domain\r
64         *  0.5 AWL AWL: From: address is in the auto white-list\r
65 X-QM-Scan-Virus: ClamAV says the message is clean\r
66 Cc: notmuch@notmuchmail.org\r
67 X-BeenThere: notmuch@notmuchmail.org\r
68 X-Mailman-Version: 2.1.13\r
69 Precedence: list\r
70 List-Id: "Use and development of the notmuch mail system."\r
71         <notmuch.notmuchmail.org>\r
72 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
73         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
74 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
75 List-Post: <mailto:notmuch@notmuchmail.org>\r
76 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
77 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
78         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
79 X-List-Received-Date: Sun, 18 Mar 2012 17:30:30 -0000\r
80 \r
81 On Sat, 17 Mar 2012 12:51:20 -0400, Austin Clements <amdragon@MIT.EDU> wrote:\r
82 > Quoth Mark Walters on Mar 15 at  6:42 pm:\r
83 > > This moves show to the --exclude=(true|false|flag) naming\r
84 > > scheme. When `exclude' is false or flag show returns all threads\r
85 > > that match including those that only match in an excluded message, the\r
86 > > difference being whether excluded messages are flagged excluded.\r
87 > > \r
88 > > When exclude=true the behaviour depends on whether --entire-threads\r
89\r
90 > s/--entire-threads/--entire-thread/\r
91 \r
92 Will fix.\r
93 \r
94 > > is set. If it is not set then show only returns the messages which\r
95 > > match and are not excluded. If it is set then show returns all\r
96 > > messages in these threads flagging the excluded messages. The\r
97\r
98 > Parse error.\r
99 \r
100 Will try and reword.\r
101 \r
102 > > rationale is that it is awkward to use a thread with some missing\r
103 > > messages.\r
104 > > ---\r
105 > >  man/man1/notmuch-show.1 |   16 ++++++++++++++--\r
106 > >  notmuch-client.h        |    1 +\r
107 > >  notmuch-show.c          |   39 +++++++++++++++++++++++++++++----------\r
108 > >  3 files changed, 44 insertions(+), 12 deletions(-)\r
109 > > \r
110 > > diff --git a/man/man1/notmuch-show.1 b/man/man1/notmuch-show.1\r
111 > > index d75d971..801b7f1 100644\r
112 > > --- a/man/man1/notmuch-show.1\r
113 > > +++ b/man/man1/notmuch-show.1\r
114 > > @@ -130,9 +130,21 @@ content.\r
115 > >  \r
116 > >  .RS 4\r
117 > >  .TP 4\r
118 > > -.B \-\-no-exclude\r
119 > > +.BR \-\-exclude=(true|false|flag)\r
120 > > +\r
121 > > +Specify whether to omit threads only matching search.tag_exclude from\r
122 > > +the search results (the default) or not. The extra option\r
123 > > +.B flag\r
124 > > +includes these messages but marks them with the excluded flag.\r
125 > > +\r
126 > > +If --entire-thread is specified then complete threads are returned\r
127 > > +regardless (with the excluded flag being set when appropriate) but\r
128 > > +threads that only match in an excluded message are not returned when\r
129 > > +.B --exclude=true.\r
130\r
131 > I found this a bit confusing.  There are two orthogonal things going\r
132 > on here: what happens to excluded messages and what happens to\r
133 > fully-excluded threads.  Is the following table accurate?\r
134\r
135 >          --entire-thread=false\r
136 >       excl. messages   excl. threads\r
137 > true       omit            omit\r
138 > false    include         include\r
139 > flag   include,flag      include\r
140\r
141 >          --entire-thread=true\r
142 >       excl. messages   excl. threads\r
143 > true   include,flag        omit\r
144 > false    include         include\r
145 > flag   include,flag      include\r
146 \r
147 This table is accurate.\r
148 \r
149 > (My reasoning: --exclude=false is equivalent to not having any\r
150 > excludes configured, --exclude=true omits excluded messages from the\r
151 > seed set and filters them in show_messages, --exclude=flag does not\r
152 > exclude messages from the seed set nor filter them in show_messages.)\r
153\r
154 > If this is right, then what's the point of having both false and flag\r
155 > for show?  I'm pretty sure their performance will be\r
156 > indistinguishable.\r
157 \r
158 I included the three options partly for completeness, partly to be the\r
159 same as notmuch-search and partly because a "flag" for mbox feels\r
160 wrong. I am happy to change it though. Do you have any good naming\r
161 suggestions?\r
162 \r
163 > > +\r
164 > > +The default is\r
165 > > +.B --exclude=true.\r
166 > >  \r
167 > > -Do not exclude the messages matching search.exclude_tags in the config file.\r
168 > >  .RE\r
169 > >  \r
170 > >  A common use of\r
171 > > diff --git a/notmuch-client.h b/notmuch-client.h\r
172 > > index f4a62cc..e36148b 100644\r
173 > > --- a/notmuch-client.h\r
174 > > +++ b/notmuch-client.h\r
175 > > @@ -99,6 +99,7 @@ typedef struct notmuch_show_format {\r
176 > >  \r
177 > >  typedef struct notmuch_show_params {\r
178 > >      notmuch_bool_t entire_thread;\r
179 > > +    notmuch_bool_t omit_excluded;\r
180 > >      notmuch_bool_t raw;\r
181 > >      int part;\r
182 > >  #ifdef GMIME_ATLEAST_26\r
183 > > diff --git a/notmuch-show.c b/notmuch-show.c\r
184 > > index 05d51b2..20d6635 100644\r
185 > > --- a/notmuch-show.c\r
186 > > +++ b/notmuch-show.c\r
187 > > @@ -812,6 +812,7 @@ show_messages (void *ctx,\r
188 > >  {\r
189 > >      notmuch_message_t *message;\r
190 > >      notmuch_bool_t match;\r
191 > > +    notmuch_bool_t excluded;\r
192 > >      int first_set = 1;\r
193 > >      int next_indent;\r
194 > >  \r
195 > > @@ -830,10 +831,11 @@ show_messages (void *ctx,\r
196 > >     message = notmuch_messages_get (messages);\r
197 > >  \r
198 > >     match = notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH);\r
199 > > +   excluded = notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED);\r
200 > >  \r
201 > >     next_indent = indent;\r
202 > >  \r
203 > > -   if (match || params->entire_thread) {\r
204 > > +   if ((match && (!excluded || !params->omit_excluded)) || params->entire_thread) {\r
205 > >         show_message (ctx, format, message, indent, params);\r
206 > >         next_indent = indent + 1;\r
207 > >  \r
208 > > @@ -974,6 +976,12 @@ enum {\r
209 > >      NOTMUCH_FORMAT_RAW\r
210 > >  };\r
211 > >  \r
212 > > +enum {\r
213 > > +    EXCLUDE_TRUE,\r
214 > > +    EXCLUDE_FALSE,\r
215 > > +    EXCLUDE_FLAG,\r
216 > > +};\r
217 > > +\r
218 > >  int\r
219 > >  notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
220 > >  {\r
221 > > @@ -983,10 +991,10 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
222 > >      char *query_string;\r
223 > >      int opt_index, ret;\r
224 > >      const notmuch_show_format_t *format = &format_text;\r
225 > > -    notmuch_show_params_t params = { .part = -1 };\r
226 > > +    notmuch_show_params_t params = { .part = -1, .omit_excluded = TRUE };\r
227 > >      int format_sel = NOTMUCH_FORMAT_NOT_SPECIFIED;\r
228 > >      notmuch_bool_t verify = FALSE;\r
229 > > -    notmuch_bool_t no_exclude = FALSE;\r
230 > > +    int exclude = EXCLUDE_TRUE;\r
231 > >  \r
232 > >      notmuch_opt_desc_t options[] = {\r
233 > >     { NOTMUCH_OPT_KEYWORD, &format_sel, "format", 'f',\r
234 > > @@ -995,11 +1003,15 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
235 > >                               { "mbox", NOTMUCH_FORMAT_MBOX },\r
236 > >                               { "raw", NOTMUCH_FORMAT_RAW },\r
237 > >                               { 0, 0 } } },\r
238 > > +        { NOTMUCH_OPT_KEYWORD, &exclude, "exclude", 'x',\r
239 > > +          (notmuch_keyword_t []){ { "true", EXCLUDE_TRUE },\r
240 > > +                                  { "false", EXCLUDE_FALSE },\r
241 > > +                                  { "flag", EXCLUDE_FLAG },\r
242 > > +                                  { 0, 0 } } },\r
243 > >     { NOTMUCH_OPT_INT, &params.part, "part", 'p', 0 },\r
244 > >     { NOTMUCH_OPT_BOOLEAN, &params.entire_thread, "entire-thread", 't', 0 },\r
245 > >     { NOTMUCH_OPT_BOOLEAN, &params.decrypt, "decrypt", 'd', 0 },\r
246 > >     { NOTMUCH_OPT_BOOLEAN, &verify, "verify", 'v', 0 },\r
247 > > -   { NOTMUCH_OPT_BOOLEAN, &no_exclude, "no-exclude", 'n', 0 },\r
248 > >     { 0, 0, 0, 0, 0 }\r
249 > >      };\r
250 > >  \r
251 > > @@ -1088,16 +1100,18 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
252 > >     return 1;\r
253 > >      }\r
254 > >  \r
255 > > -    /* if format=mbox then we can not output excluded messages as\r
256 > > -     * there is no way to make the exclude flag available */\r
257 > > -    if (format_sel == NOTMUCH_FORMAT_MBOX)\r
258 > > -   notmuch_query_set_omit_excluded_messages (query, TRUE);\r
259 > > -\r
260 > >      /* If a single message is requested we do not use search_excludes. */\r
261 > >      if (params.part >= 0)\r
262 > >     ret = do_show_single (ctx, query, format, &params);\r
263 > >      else {\r
264 > > -   if (!no_exclude) {\r
265 > > +   if (format == &format_mbox && exclude == EXCLUDE_FLAG) {\r
266 > > +       /* there is no where to mark flagged messages so fall back on\r
267\r
268 > s/no where/nowhere/  Also, s/there/There/ for style consistency.\r
269\r
270 > > +        * including the excluded messages */\r
271 > > +       fprintf (stderr, "Cannot flag excluded messages with format=mbox: fall back on just including them\n");\r
272\r
273 > This is a bit verbose.  How about just "Warning: mbox cannot flag\r
274 > excluded messages"?  Flag already means that the messages should be\r
275 > included, so this message states exactly what mbox isn't doing that\r
276 > you might expect it to.\r
277 \r
278 I like this and will change to it.\r
279 \r
280 > > +       exclude = EXCLUDE_FALSE;\r
281 > > +   }\r
282 > > +\r
283 > > +   if (exclude != EXCLUDE_FALSE) {\r
284 > >         const char **search_exclude_tags;\r
285 > >         size_t search_exclude_tags_length;\r
286 > >         unsigned int i;\r
287 > > @@ -1106,7 +1120,12 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
288 > >             (config, &search_exclude_tags_length);\r
289 > >         for (i = 0; i < search_exclude_tags_length; i++)\r
290 > >             notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);\r
291 > > +       if (exclude == EXCLUDE_FLAG) {\r
292 > > +           notmuch_query_set_omit_excluded_messages(query, FALSE);\r
293 > > +           params.omit_excluded = FALSE;\r
294 > > +       }\r
295 > >     }\r
296 > > +\r
297 > >     ret = do_show (ctx, query, format, &params);\r
298 > >      }\r
299 > >  \r
300 \r
301 Thanks\r
302 \r
303 Mark\r