Re: [PATCH v4 5/6] cli: search: Add configurable way to filter out duplicate addresses
[notmuch-archives.git] / ac / 02c73d49a374472ee37cfe70d62d5a1b4b8b43
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 71332431E64\r
6         for <notmuch@notmuchmail.org>; Mon, 30 Jan 2012 20:18:27 -0800 (PST)\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 akhuy1ezm+56 for <notmuch@notmuchmail.org>;\r
16         Mon, 30 Jan 2012 20:18:26 -0800 (PST)\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 B407B431FBC\r
20         for <notmuch@notmuchmail.org>; Mon, 30 Jan 2012 20:18:26 -0800 (PST)\r
21 X-AuditID: 12074422-b7fd66d0000008f9-ae-4f276b92e084\r
22 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
23         by dmz-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id B1.F4.02297.29B672F4; Mon, 30 Jan 2012 23:18:26 -0500 (EST)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id q0V4IPxl030295; \r
27         Mon, 30 Jan 2012 23:18:26 -0500\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 q0V4INfx025696\r
32         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
33         Mon, 30 Jan 2012 23:18:24 -0500 (EST)\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 1Rs59w-0002ks-7a; Mon, 30 Jan 2012 23:17:32 -0500\r
37 Date: Mon, 30 Jan 2012 23:17:32 -0500\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: Mark Walters <markwalters1009@gmail.com>\r
40 Subject: Re: [PATCH 1/7] cli: add --do-not-exclude option to count and search.\r
41 Message-ID: <20120131041732.GY17991@mit.edu>\r
42 References: <8762fu4aqt.fsf@qmul.ac.uk>\r
43         <1327862394-14334-1-git-send-email-markwalters1009@gmail.com>\r
44 MIME-Version: 1.0\r
45 Content-Type: text/plain; charset=us-ascii\r
46 Content-Disposition: inline\r
47 In-Reply-To: <1327862394-14334-1-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+NgFmpmleLIzCtJLcpLzFFi42IRYrdT152Ure5vMHEZv8XquTwW12/OZHZg\r
51         8tg56y67x7NVt5gDmKK4bFJSczLLUov07RK4MtbNPsdacFSm4uSKR2wNjAvEuhg5OSQETCT+\r
52         3+png7DFJC7cWw9kc3EICexjlHh1ZAMLhLOBUeLX6wtMEM5JJokpW+exQzhLGCVaJ69mB+ln\r
53         EVCVmHb6AwuIzSagIbFt/3JGEFtEQEfi9qEFYDXMAtIS3343M4HYwgJ+Ep+fT2AGsXmBag6v\r
54         ngtWIySQLtHVPYkNIi4ocXLmExaIXi2JG/9eAvVygM1Z/o8DJMwp4CVxa+4ZsFWiAioSU05u\r
55         Y5vAKDQLSfcsJN2zELoXMDKvYpRNya3SzU3MzClOTdYtTk7My0st0jXVy80s0UtNKd3ECA5r\r
56         F6UdjD8PKh1iFOBgVOLh3fNezV+INbGsuDL3EKMkB5OSKG9Pprq/EF9SfkplRmJxRnxRaU5q\r
57         8SFGCQ5mJRHeN6uBynlTEiurUovyYVLSHCxK4rzqWu/8gP5NLEnNTk0tSC2CycpwcChJ8DIA\r
58         41dIsCg1PbUiLTOnBCHNxMEJMpwHaLg5SA1vcUFibnFmOkT+FKOilDivIEhCACSRUZoH1wtL\r
59         O68YxYFeEeYVBaniAaYsuO5XQIOZgAY/Z1AFGVySiJCSamCUUto35YXQt74LOZ7HeiRUp+Q1\r
60         /dGZ8uCA8fQD75l5lvfs7+Lf9+uTBFdKUPL/G11/1JNzk4/pKOTfb++QfHAopl+vVaRgAnva\r
61         7/OLgrd6nZNgCON65m7ysX+rP/vEr5GW7za/mhxyK/3hSvUL4bW6OoxJp2aEe6Wvn6fQP/9q\r
62         PE91TcrnioVKLMUZiYZazEXFiQD5axLcFgMAAA==\r
63 Cc: notmuch@notmuchmail.org\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: Tue, 31 Jan 2012 04:18:27 -0000\r
77 \r
78 Quoth Mark Walters on Jan 29 at  6:39 pm:\r
79 > This option turns off the exclusion so all matching messages are\r
80 > returned. We do not need to add this to show as notmuch-show does not\r
81 > (yet) exclude.\r
82 > ---\r
83 >  notmuch-count.c  |   12 ++++++++----\r
84 >  notmuch-search.c |   12 ++++++++----\r
85 >  2 files changed, 16 insertions(+), 8 deletions(-)\r
86\r
87 > diff --git a/notmuch-count.c b/notmuch-count.c\r
88 > index 63459fb..c88975e 100644\r
89 > --- a/notmuch-count.c\r
90 > +++ b/notmuch-count.c\r
91 > @@ -37,6 +37,7 @@ notmuch_count_command (void *ctx, int argc, char *argv[])\r
92 >      int output = OUTPUT_MESSAGES;\r
93 >      const char **search_exclude_tags;\r
94 >      size_t search_exclude_tags_length;\r
95 > +    notmuch_bool_t do_not_exclude = FALSE;\r
96 >      unsigned int i;\r
97 >  \r
98 >      notmuch_opt_desc_t options[] = {\r
99 > @@ -44,6 +45,7 @@ notmuch_count_command (void *ctx, int argc, char *argv[])\r
100 >         (notmuch_keyword_t []){ { "threads", OUTPUT_THREADS },\r
101 >                                 { "messages", OUTPUT_MESSAGES },\r
102 >                                 { 0, 0 } } },\r
103 > +     { NOTMUCH_OPT_BOOLEAN,  &do_not_exclude, "do-not-exclude", 'd', 0 },\r
104 \r
105 Maybe just "no-exclude"?  "do-not-exclude" seems needlessly verbose.\r
106 \r
107 Also, you have an extra space after the first comma.\r
108 \r
109 >       { 0, 0, 0, 0, 0 }\r
110 >      };\r
111 >  \r
112 > @@ -78,10 +80,12 @@ notmuch_count_command (void *ctx, int argc, char *argv[])\r
113 >       return 1;\r
114 >      }\r
115 >  \r
116 > -    search_exclude_tags = notmuch_config_get_search_exclude_tags\r
117 > -     (config, &search_exclude_tags_length);\r
118 > -    for (i = 0; i < search_exclude_tags_length; i++)\r
119 > -     notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);\r
120 > +    if (!do_not_exclude) {\r
121 \r
122 You could move search_exclude_tags and search_exclude_tags_length in\r
123 here now that it's a block (but you don't have to).\r
124 \r
125 > +     search_exclude_tags = notmuch_config_get_search_exclude_tags\r
126 > +         (config, &search_exclude_tags_length);\r
127 > +     for (i = 0; i < search_exclude_tags_length; i++)\r
128 > +         notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);\r
129 > +    }\r
130 >  \r
131 >      switch (output) {\r
132 >      case OUTPUT_MESSAGES:\r
133 > diff --git a/notmuch-search.c b/notmuch-search.c\r
134 > index d504051..084dd05 100644\r
135 > --- a/notmuch-search.c\r
136 > +++ b/notmuch-search.c\r
137 > @@ -425,6 +425,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[])\r
138 >      int limit = -1; /* unlimited */\r
139 >      const char **search_exclude_tags;\r
140 >      size_t search_exclude_tags_length;\r
141 > +    notmuch_bool_t do_not_exclude = FALSE;\r
142 >      unsigned int i;\r
143 >  \r
144 >      enum { NOTMUCH_FORMAT_JSON, NOTMUCH_FORMAT_TEXT }\r
145 > @@ -446,6 +447,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[])\r
146 >                                 { "files", OUTPUT_FILES },\r
147 >                                 { "tags", OUTPUT_TAGS },\r
148 >                                 { 0, 0 } } },\r
149 > +        { NOTMUCH_OPT_BOOLEAN,  &do_not_exclude, "do-not-exclude", 'd', 0 },\r
150 \r
151 Same.\r
152 \r
153 >       { NOTMUCH_OPT_INT, &offset, "offset", 'O', 0 },\r
154 >       { NOTMUCH_OPT_INT, &limit, "limit", 'L', 0  },\r
155 >       { 0, 0, 0, 0, 0 }\r
156 > @@ -493,10 +495,12 @@ notmuch_search_command (void *ctx, int argc, char *argv[])\r
157 >  \r
158 >      notmuch_query_set_sort (query, sort);\r
159 >  \r
160 > -    search_exclude_tags = notmuch_config_get_search_exclude_tags\r
161 > -     (config, &search_exclude_tags_length);\r
162 > -    for (i = 0; i < search_exclude_tags_length; i++)\r
163 > -     notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);\r
164 > +    if (!do_not_exclude) {\r
165 > +     search_exclude_tags = notmuch_config_get_search_exclude_tags\r
166 > +         (config, &search_exclude_tags_length);\r
167 > +     for (i = 0; i < search_exclude_tags_length; i++)\r
168 > +         notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);\r
169 > +    }\r
170 >  \r
171 >      switch (output) {\r
172 >      default:\r