Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 0d / 748648a849332a72fa4dac71b86653a2145838
1 Return-Path: <markwalters1009@gmail.com>\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 9AA66431FAF\r
6         for <notmuch@notmuchmail.org>; Sat,  7 Apr 2012 09:10:38 -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.201\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
14         RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
15 Received: from olra.theworths.org ([127.0.0.1])\r
16         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
17         with ESMTP id YJ3GEfC20Hcu for <notmuch@notmuchmail.org>;\r
18         Sat,  7 Apr 2012 09:10:37 -0700 (PDT)\r
19 Received: from mail-wg0-f45.google.com (mail-wg0-f45.google.com\r
20  [74.125.82.45])        (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
21  certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
22  66470431FD6    for <notmuch@notmuchmail.org>; Sat,  7 Apr 2012 09:10:33 -0700\r
23  (PDT)\r
24 Received: by mail-wg0-f45.google.com with SMTP id dt14so822285wgb.2\r
25         for <notmuch@notmuchmail.org>; Sat, 07 Apr 2012 09:10:33 -0700 (PDT)\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
27         h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
28         bh=RNjegDaofYgFUQpzYcXKNg4I08qTfgYpkZy4yVH/O1g=;\r
29         b=u6Puc1VuJxHWdhNFV2V5LN2yjcrm7t/MsBXRNt/LZpkMxFdgBSWj0IpTxempYCOGK7\r
30         fIMQOZZACL+tjlFPLDN5JuXC0l3gageV2Y15eM36f2BOMXdjPOjZv3dcNjfab++b/I3Z\r
31         dCqTy1z3hr5FgyB5ABAwrvMX75G7fX/GiwTI2wQBSPLDC5J/+oUdFB6UDvLZgBWdyAGj\r
32         RH1s5Sf2G6Oxh0IDA7KqWqrlNxt8W3DiMiPSdkSHd1f0oQKFNeuU8oEG62tIvwNXsrsu\r
33         t1vL9ymov7s1nXF576+aLRvP/canHkvjQKfx5x6QRi7m1lyNLlbjrGJGENykjbeVCAga\r
34         z7MQ==\r
35 Received: by 10.216.150.148 with SMTP id z20mr1046402wej.22.1333815033050;\r
36         Sat, 07 Apr 2012 09:10:33 -0700 (PDT)\r
37 Received: from localhost (94.197.17.51.threembb.co.uk. [94.197.17.51])\r
38         by mx.google.com with ESMTPS id o2sm25308770wiv.11.2012.04.07.09.10.26\r
39         (version=TLSv1/SSLv3 cipher=OTHER);\r
40         Sat, 07 Apr 2012 09:10:32 -0700 (PDT)\r
41 From: Mark Walters <markwalters1009@gmail.com>\r
42 To: notmuch@notmuchmail.org\r
43 Subject: [PATCH v4 3/6] cli: move search to the new --exclude= naming scheme.\r
44 Date: Sat,  7 Apr 2012 17:10:05 +0100\r
45 Message-Id: <1333815008-24668-4-git-send-email-markwalters1009@gmail.com>\r
46 X-Mailer: git-send-email 1.7.9.1\r
47 In-Reply-To: <1333815008-24668-1-git-send-email-markwalters1009@gmail.com>\r
48 References: <1333815008-24668-1-git-send-email-markwalters1009@gmail.com>\r
49 X-BeenThere: notmuch@notmuchmail.org\r
50 X-Mailman-Version: 2.1.13\r
51 Precedence: list\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: Sat, 07 Apr 2012 16:10:39 -0000\r
62 \r
63 This commit replaces the --no-exclude option with a\r
64 --exclude=(true|false|flag) option. The default is to omit the\r
65 excluded messages.\r
66 \r
67 The flag option only makes sense if output=summary (as otherwise there\r
68 is nowhere to print the flag). In summary output exclude=false and\r
69 exclude=flag give almost identical output:\r
70 they differ in that with the exclude=flag option the match count\r
71 (i.e., the x in [x/n] in the output) is the number of matching\r
72 non-excluded messages rather than the number of matching messages.\r
73 \r
74 Note this changes the default for output=summary when no --exclude=\r
75 option is given: it used to default to flag and now defaults to true\r
76 (i.e. omit excluded messages). This is neccesary to keep the cli\r
77 output uncluttered and for speed reasons.\r
78 ---\r
79  man/man1/notmuch-search.1 |   12 +++++++++---\r
80  notmuch-search.c          |   32 +++++++++++++++++++++++---------\r
81  2 files changed, 32 insertions(+), 12 deletions(-)\r
82 \r
83 diff --git a/man/man1/notmuch-search.1 b/man/man1/notmuch-search.1\r
84 index 06d81a6..ebb61fc 100644\r
85 --- a/man/man1/notmuch-search.1\r
86 +++ b/man/man1/notmuch-search.1\r
87 @@ -114,9 +114,15 @@ Limit the number of displayed results to N.\r
88  \r
89  .RS 4\r
90  .TP 4\r
91 -.BR \-\-no\-exclude\r
92 -\r
93 -Do not exclude the messages matching search.exclude_tags in the config file.\r
94 +.BR \-\-exclude=(true|false|flag)\r
95 +\r
96 +Specify whether to omit messages matching search.tag_exclude from the\r
97 +search results (the default) or not. The extra option\r
98 +.B flag\r
99 +only has an effect when\r
100 +.B --output=summary\r
101 +In this case all matching threads are returned but the "match count"\r
102 +is the number of matching non-excluded messages in the thread.\r
103  .RE\r
104  \r
105  .SH SEE ALSO\r
106 diff --git a/notmuch-search.c b/notmuch-search.c\r
107 index f6061e4..1cc8430 100644\r
108 --- a/notmuch-search.c\r
109 +++ b/notmuch-search.c\r
110 @@ -210,9 +210,6 @@ do_search_threads (const search_format_t *format,\r
111      int first_thread = 1;\r
112      int i;\r
113  \r
114 -    if (output == OUTPUT_THREADS)\r
115 -       notmuch_query_set_omit_excluded_messages (query, TRUE);\r
116 -\r
117      if (offset < 0) {\r
118         offset += notmuch_query_count_threads (query);\r
119         if (offset < 0)\r
120 @@ -303,8 +300,6 @@ do_search_messages (const search_format_t *format,\r
121      int first_message = 1;\r
122      int i;\r
123  \r
124 -    notmuch_query_set_omit_excluded_messages (query, TRUE);\r
125 -\r
126      if (offset < 0) {\r
127         offset += notmuch_query_count_messages (query);\r
128         if (offset < 0)\r
129 @@ -376,7 +371,6 @@ do_search_tags (notmuch_database_t *notmuch,\r
130      const char *tag;\r
131      int first_tag = 1;\r
132  \r
133 -    notmuch_query_set_omit_excluded_messages (query, TRUE);\r
134      /* should the following only special case if no excluded terms\r
135       * specified? */\r
136  \r
137 @@ -422,6 +416,12 @@ do_search_tags (notmuch_database_t *notmuch,\r
138      return 0;\r
139  }\r
140  \r
141 +enum {\r
142 +    EXCLUDE_TRUE,\r
143 +    EXCLUDE_FALSE,\r
144 +    EXCLUDE_FLAG,\r
145 +};\r
146 +\r
147  int\r
148  notmuch_search_command (void *ctx, int argc, char *argv[])\r
149  {\r
150 @@ -435,7 +435,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[])\r
151      output_t output = OUTPUT_SUMMARY;\r
152      int offset = 0;\r
153      int limit = -1; /* unlimited */\r
154 -    notmuch_bool_t no_exclude = FALSE;\r
155 +    int exclude = EXCLUDE_TRUE;\r
156      unsigned int i;\r
157  \r
158      enum { NOTMUCH_FORMAT_JSON, NOTMUCH_FORMAT_TEXT }\r
159 @@ -457,7 +457,11 @@ notmuch_search_command (void *ctx, int argc, char *argv[])\r
160                                   { "files", OUTPUT_FILES },\r
161                                   { "tags", OUTPUT_TAGS },\r
162                                   { 0, 0 } } },\r
163 -       { NOTMUCH_OPT_BOOLEAN, &no_exclude, "no-exclude", 'd', 0 },\r
164 +        { NOTMUCH_OPT_KEYWORD, &exclude, "exclude", 'x',\r
165 +          (notmuch_keyword_t []){ { "true", EXCLUDE_TRUE },\r
166 +                                  { "false", EXCLUDE_FALSE },\r
167 +                                  { "flag", EXCLUDE_FLAG },\r
168 +                                  { 0, 0 } } },\r
169         { NOTMUCH_OPT_INT, &offset, "offset", 'O', 0 },\r
170         { NOTMUCH_OPT_INT, &limit, "limit", 'L', 0  },\r
171         { 0, 0, 0, 0, 0 }\r
172 @@ -505,7 +509,15 @@ notmuch_search_command (void *ctx, int argc, char *argv[])\r
173  \r
174      notmuch_query_set_sort (query, sort);\r
175  \r
176 -    if (!no_exclude) {\r
177 +    if (exclude == EXCLUDE_FLAG && output != OUTPUT_SUMMARY) {\r
178 +       /* If we are not doing summary output there is nowhere to\r
179 +        * print the excluded flag so fall back on including the\r
180 +        * excluded messages. */\r
181 +       fprintf (stderr, "Warning: this output format cannot flag excluded messages.\n");\r
182 +       exclude = EXCLUDE_FALSE;\r
183 +    }\r
184 +\r
185 +    if (exclude == EXCLUDE_TRUE || exclude == EXCLUDE_FLAG) {\r
186         const char **search_exclude_tags;\r
187         size_t search_exclude_tags_length;\r
188  \r
189 @@ -513,6 +525,8 @@ notmuch_search_command (void *ctx, int argc, char *argv[])\r
190             (config, &search_exclude_tags_length);\r
191         for (i = 0; i < search_exclude_tags_length; i++)\r
192             notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);\r
193 +       if (exclude == EXCLUDE_FLAG)\r
194 +           notmuch_query_set_omit_excluded (query, FALSE);\r
195      }\r
196  \r
197      switch (output) {\r
198 -- \r
199 1.7.9.1\r
200 \r