Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / a9 / a8fdafef1addfe2ca2bbe069870cfa33a7bb0b
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 E8AFD431FB6\r
6         for <notmuch@notmuchmail.org>; Thu,  5 Apr 2012 18:18:19 -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 NykhzrfukBUF for <notmuch@notmuchmail.org>;\r
16         Thu,  5 Apr 2012 18:18:19 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-3.mit.edu (DMZ-MAILSEC-SCANNER-3.MIT.EDU\r
18         [18.9.25.14])\r
19         by olra.theworths.org (Postfix) with ESMTP id 102A7431FAE\r
20         for <notmuch@notmuchmail.org>; Thu,  5 Apr 2012 18:18:18 -0700 (PDT)\r
21 X-AuditID: 1209190e-b7f7c6d0000008c3-e3-4f7e4459f9ac\r
22 Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
23         by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id AC.99.02243.9544E7F4; Thu,  5 Apr 2012 21:18:17 -0400 (EDT)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id q361IGTW007494; \r
27         Thu, 5 Apr 2012 21:18:17 -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 q361IFgH014638\r
32         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
33         Thu, 5 Apr 2012 21:18:16 -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 1SFxod-0004QO-J9; Thu, 05 Apr 2012 21:18:15 -0400\r
37 From: Austin Clements <amdragon@MIT.EDU>\r
38 To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org\r
39 Subject: Re: [PATCH v2 3/6] cli: move search to the new --exclude= naming\r
40         scheme.\r
41 In-Reply-To: <1333234442-28616-4-git-send-email-markwalters1009@gmail.com>\r
42 References: <1333234442-28616-1-git-send-email-markwalters1009@gmail.com>\r
43         <1333234442-28616-4-git-send-email-markwalters1009@gmail.com>User-Agent:\r
44         Notmuch/0.11.1+358~g3b96caf (http://notmuchmail.org)\r
45         Emacs/23.3.1 (i486-pc-linux-gnu)\r
46 Date: Thu, 05 Apr 2012 21:18:15 -0400\r
47 Message-ID: <87398hd5ew.fsf@awakening.csail.mit.edu>\r
48 MIME-Version: 1.0\r
49 Content-Type: text/plain; charset=us-ascii\r
50 X-Brightmail-Tracker:\r
51  H4sIAAAAAAAAA+NgFnrEIsWRmVeSWpSXmKPExsUixG6nohvpUudvMHeBtsXquTwW12/OZHZg\r
52         8tg56y67x7NVt5gDmKK4bFJSczLLUov07RK4Mr5OXslecFG3YvPxZvYGxi9KXYycHBICJhJT\r
53         V09igbDFJC7cW8/WxcjFISSwj1Hixq6LjBDOekaJtedXskM4J5gkVp/4xQLhLGGU6Ly1ih2k\r
54         n01AQ2Lb/uWMILaIgKvE02+fmUFsYYFAidZ7p8HinAJeEv/3n2CCaH7BKNF9qgVsOYuAqsTV\r
55         tgVgRbxARz2b/4EZwhaUODnzCVgNs4CWxI1/L5kmMPLPQpKahSS1gJFpFaNsSm6Vbm5iZk5x\r
56         arJucXJiXl5qka6xXm5miV5qSukmRlDwcUry7WD8elDpEKMAB6MSD2/x5lp/IdbEsuLK3EOM\r
57         khxMSqK8bA51/kJ8SfkplRmJxRnxRaU5qcWHGCU4mJVEeJ/yA+V4UxIrq1KL8mFS0hwsSuK8\r
58         alrv/IQE0hNLUrNTUwtSi2CyMhwcShK8oc5AjYJFqempFWmZOSUIaSYOTpDhPEDDG0BqeIsL\r
59         EnOLM9Mh8qcYdTmeH+q9wijEkpeflyolztsJUiQAUpRRmgc3B5Y0XjGKA70lzLsCpIoHmHDg\r
60         Jr0CWsIEtOTk12qQJSWJCCmpBsZEKetXu5um7boqas+p5urtpFu0R87pXV7AKa7snABW7aZp\r
61         tZVLWAXzngh26/Oet/1z5e6esIuvD2zZfvdH/+lw2093ylc9W7/RhkHqW2XorAalwDw7fv/T\r
62         Va7/57jz5JwRD569vXnX9argtvgk+wU2JdWyQbWO/wJUN4VdymphOjBT4/3SbUosxRmJhlrM\r
63         RcWJAJ/n+H31AgAA\r
64 X-BeenThere: notmuch@notmuchmail.org\r
65 X-Mailman-Version: 2.1.13\r
66 Precedence: list\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: Fri, 06 Apr 2012 01:18:20 -0000\r
77 \r
78 On Sat, 31 Mar 2012, Mark Walters <markwalters1009@gmail.com> wrote:\r
79 > This commit replaces the --no-exclude option with a\r
80 > --exclude=(true|false|flag) option. The default is to omit the\r
81 > excluded messages.\r
82 >\r
83 > The flag option only makes sense if output=summary (as otherwise there\r
84 > is nowhere to print the flag). In summary output exclude=false and\r
85 > exclude=flag give almost identical output:\r
86 > they differ in that with the exclude=flag option the match count\r
87 > (i.e., the x in [x/n] in the output) is the number of matching\r
88 > non-excluded messages rather than the number of matching messages.\r
89 >\r
90 > Note this changes the default for output=summary when no --exclude=\r
91 > option is given: it used to default to flag and now defaults to true\r
92 > (i.e. omit excluded messages). This is neccesary to keep the cli\r
93 > output uncluttered and for speed reasons.\r
94 > ---\r
95 >  man/man1/notmuch-search.1 |   12 +++++++++---\r
96 >  notmuch-search.c          |   32 +++++++++++++++++++++++---------\r
97 >  2 files changed, 32 insertions(+), 12 deletions(-)\r
98 >\r
99 > diff --git a/man/man1/notmuch-search.1 b/man/man1/notmuch-search.1\r
100 > index 06d81a6..ebb61fc 100644\r
101 > --- a/man/man1/notmuch-search.1\r
102 > +++ b/man/man1/notmuch-search.1\r
103 > @@ -114,9 +114,15 @@ Limit the number of displayed results to N.\r
104 >  \r
105 >  .RS 4\r
106 >  .TP 4\r
107 > -.BR \-\-no\-exclude\r
108 > -\r
109 > -Do not exclude the messages matching search.exclude_tags in the config file.\r
110 > +.BR \-\-exclude=(true|false|flag)\r
111 > +\r
112 > +Specify whether to omit messages matching search.tag_exclude from the\r
113 > +search results (the default) or not. The extra option\r
114 > +.B flag\r
115 > +only has an effect when\r
116 > +.B --output=summary\r
117 > +In this case all matching threads are returned but the "match count"\r
118 > +is the number of matching non-excluded messages in the thread.\r
119 >  .RE\r
120 >  \r
121 >  .SH SEE ALSO\r
122 > diff --git a/notmuch-search.c b/notmuch-search.c\r
123 > index f6061e4..fe18a93 100644\r
124 > --- a/notmuch-search.c\r
125 > +++ b/notmuch-search.c\r
126 > @@ -210,9 +210,6 @@ do_search_threads (const search_format_t *format,\r
127 >      int first_thread = 1;\r
128 >      int i;\r
129 >  \r
130 > -    if (output == OUTPUT_THREADS)\r
131 > -     notmuch_query_set_omit_excluded_messages (query, TRUE);\r
132 > -\r
133 >      if (offset < 0) {\r
134 >       offset += notmuch_query_count_threads (query);\r
135 >       if (offset < 0)\r
136 > @@ -303,8 +300,6 @@ do_search_messages (const search_format_t *format,\r
137 >      int first_message = 1;\r
138 >      int i;\r
139 >  \r
140 > -    notmuch_query_set_omit_excluded_messages (query, TRUE);\r
141 > -\r
142 >      if (offset < 0) {\r
143 >       offset += notmuch_query_count_messages (query);\r
144 >       if (offset < 0)\r
145 > @@ -376,7 +371,6 @@ do_search_tags (notmuch_database_t *notmuch,\r
146 >      const char *tag;\r
147 >      int first_tag = 1;\r
148 >  \r
149 > -    notmuch_query_set_omit_excluded_messages (query, TRUE);\r
150 >      /* should the following only special case if no excluded terms\r
151 >       * specified? */\r
152 >  \r
153 > @@ -422,6 +416,12 @@ do_search_tags (notmuch_database_t *notmuch,\r
154 >      return 0;\r
155 >  }\r
156 >  \r
157 > +enum {\r
158 > +    EXCLUDE_TRUE,\r
159 > +    EXCLUDE_FALSE,\r
160 > +    EXCLUDE_FLAG,\r
161 > +};\r
162 > +\r
163 >  int\r
164 >  notmuch_search_command (void *ctx, int argc, char *argv[])\r
165 >  {\r
166 > @@ -435,7 +435,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[])\r
167 >      output_t output = OUTPUT_SUMMARY;\r
168 >      int offset = 0;\r
169 >      int limit = -1; /* unlimited */\r
170 > -    notmuch_bool_t no_exclude = FALSE;\r
171 > +    int exclude = EXCLUDE_TRUE;\r
172 >      unsigned int i;\r
173 >  \r
174 >      enum { NOTMUCH_FORMAT_JSON, NOTMUCH_FORMAT_TEXT }\r
175 > @@ -457,7 +457,11 @@ notmuch_search_command (void *ctx, int argc, char *argv[])\r
176 >                                 { "files", OUTPUT_FILES },\r
177 >                                 { "tags", OUTPUT_TAGS },\r
178 >                                 { 0, 0 } } },\r
179 > -     { NOTMUCH_OPT_BOOLEAN, &no_exclude, "no-exclude", 'd', 0 },\r
180 > +        { NOTMUCH_OPT_KEYWORD, &exclude, "exclude", 'x',\r
181 > +          (notmuch_keyword_t []){ { "true", EXCLUDE_TRUE },\r
182 > +                                  { "false", EXCLUDE_FALSE },\r
183 > +                                  { "flag", EXCLUDE_FLAG },\r
184 > +                                  { 0, 0 } } },\r
185 >       { NOTMUCH_OPT_INT, &offset, "offset", 'O', 0 },\r
186 >       { NOTMUCH_OPT_INT, &limit, "limit", 'L', 0  },\r
187 >       { 0, 0, 0, 0, 0 }\r
188 > @@ -505,7 +509,15 @@ notmuch_search_command (void *ctx, int argc, char *argv[])\r
189 >  \r
190 >      notmuch_query_set_sort (query, sort);\r
191 >  \r
192 > -    if (!no_exclude) {\r
193 > +    if (exclude == EXCLUDE_FLAG && output != OUTPUT_SUMMARY) {\r
194 > +     /* if we are not doing summary output there is no where to\r
195 \r
196 s/no where/nowhere/.  Also, s/if/If/ for style consistency.\r
197 \r
198 > +      * print the excluded flag so fall back on including the\r
199 > +      * excluded messages */\r
200 > +     fprintf (stderr, "Cannot flag excluded messages with this output: fall back on just including them\n");\r
201 \r
202 I commented on the equivalent of this message in the last version of the\r
203 show patch (and now that code is gone anyway), but must have missed it\r
204 here.  How about just "Warning: this output format cannot flag excluded\r
205 messages"?  Flag already implies including them, so all you're not doing\r
206 in this case is flagging them.\r
207 \r
208 > +     exclude = EXCLUDE_FALSE;\r
209 > +    }\r
210 > +\r
211 > +    if (exclude == EXCLUDE_TRUE || exclude == EXCLUDE_FLAG) {\r
212 >       const char **search_exclude_tags;\r
213 >       size_t search_exclude_tags_length;\r
214 >  \r
215 > @@ -513,6 +525,8 @@ notmuch_search_command (void *ctx, int argc, char *argv[])\r
216 >           (config, &search_exclude_tags_length);\r
217 >       for (i = 0; i < search_exclude_tags_length; i++)\r
218 >           notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);\r
219 > +     if (exclude == EXCLUDE_FLAG)\r
220 > +         notmuch_query_set_omit_excluded_messages (query, FALSE);\r
221 >      }\r
222 >  \r
223 >      switch (output) {\r
224 > -- \r
225 > 1.7.9.1\r
226 >\r
227 > _______________________________________________\r
228 > notmuch mailing list\r
229 > notmuch@notmuchmail.org\r
230 > http://notmuchmail.org/mailman/listinfo/notmuch\r