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 E8937431FAE
\r
6 for <notmuch@notmuchmail.org>; Sat, 22 Jun 2013 03:10:53 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=1.401 tagged_above=-999 required=5
\r
12 tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,
\r
13 FREEMAIL_REPLY=2.499, NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3]
\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 4VKkL8mFe7wb for <notmuch@notmuchmail.org>;
\r
18 Sat, 22 Jun 2013 03:10:43 -0700 (PDT)
\r
19 Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])
\r
20 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
\r
21 (No client certificate requested)
\r
22 by olra.theworths.org (Postfix) with ESMTPS id 0AE78431FB6
\r
23 for <notmuch@notmuchmail.org>; Sat, 22 Jun 2013 03:10:43 -0700 (PDT)
\r
24 Received: from smtp.qmul.ac.uk ([138.37.6.40])
\r
25 by mail2.qmul.ac.uk with esmtp (Exim 4.71)
\r
26 (envelope-from <m.walters@qmul.ac.uk>)
\r
27 id 1UqKm9-00043c-Sx; Sat, 22 Jun 2013 11:10:39 +0100
\r
28 Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost)
\r
29 by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)
\r
30 (envelope-from <m.walters@qmul.ac.uk>)
\r
31 id 1UqKm9-0001NP-Bv; Sat, 22 Jun 2013 11:10:33 +0100
\r
32 From: Mark Walters <markwalters1009@gmail.com>
\r
33 To: Tomi Ollila <tomi.ollila@iki.fi>, notmuch@notmuchmail.org
\r
34 Subject: Re: [PATCH v3 7/8] lib: add NOTMUCH_EXCLUDE_FLAG to notmuch_exclude_t
\r
35 In-Reply-To: <m2txkrk9ua.fsf@guru.guru-group.fi>
\r
36 References: <1368301809-12532-1-git-send-email-markwalters1009@gmail.com>
\r
37 <1368301809-12532-8-git-send-email-markwalters1009@gmail.com>
\r
38 <87bo8edif8.fsf@qmul.ac.uk> <87fvwdx19x.fsf@qmul.ac.uk>
\r
39 <m2txkrk9ua.fsf@guru.guru-group.fi>
\r
40 User-Agent: Notmuch/0.15.2+171~ge2f30a2 (http://notmuchmail.org) Emacs/23.4.1
\r
42 Date: Sat, 22 Jun 2013 11:10:32 +0100
\r
43 Message-ID: <87ppve317r.fsf@qmul.ac.uk>
\r
45 Content-Type: text/plain; charset=us-ascii
\r
46 X-Sender-Host-Address: 93.97.24.31
\r
47 X-QM-SPAM-Info: Sender has good ham record. :)
\r
48 X-QM-Body-MD5: 1a987b67cd04be55696806cf47de126c (of first 20000 bytes)
\r
49 X-SpamAssassin-Score: 0.6
\r
50 X-SpamAssassin-SpamBar: /
\r
51 X-SpamAssassin-Report: The QM spam filters have analysed this message to
\r
53 spam. We require at least 5.0 points to mark a message as spam.
\r
54 This message scored 0.6 points. Summary of the scoring:
\r
55 * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail
\r
56 provider * (markwalters1009[at]gmail.com)
\r
57 * 1.0 FREEMAIL_REPLY From and body contain different freemails
\r
58 * -0.4 AWL AWL: From: address is in the auto white-list
\r
59 X-QM-Scan-Virus: ClamAV says the message is clean
\r
60 X-BeenThere: notmuch@notmuchmail.org
\r
61 X-Mailman-Version: 2.1.13
\r
63 List-Id: "Use and development of the notmuch mail system."
\r
64 <notmuch.notmuchmail.org>
\r
65 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
66 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
67 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
68 List-Post: <mailto:notmuch@notmuchmail.org>
\r
69 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
70 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
71 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
72 X-List-Received-Date: Sat, 22 Jun 2013 10:10:54 -0000
\r
74 Tomi Ollila <tomi.ollila@iki.fi> writes:
\r
76 > On Thu, Jun 20 2013, Mark Walters <markwalters1009@gmail.com> wrote:
\r
78 >> I think we should decide before 0.16 whether to go with this patch and
\r
79 >> patch 8/8 or for Peter's suggestion at
\r
80 >> id:1368454815-1854-1-git-send-email-novalazy@gmail.com
\r
82 >> Now we have an enum for the NOTMUCH_EXCLUDE possibilities (rather than a
\r
83 >> bool) I think it makes sense to implement NOTMUCH_EXCLUDE_FALSE properly
\r
84 >> but I am happy with either choice.
\r
86 > So, the choice here is to choose between
\r
88 > id:"1368454815-1854-1-git-send-email-novalazy@gmail.com"
\r
90 > id:"87bo8edif8.fsf@qmul.ac.uk"
\r
92 I think if we go with the latter then it would make sense to also do
\r
93 id:1368301809-12532-9-git-send-email-markwalters1009@gmail.com
\r
94 (or something similar)
\r
101 > (might be hard to catch from this thread -- was easier to take from
\r
102 > http://nmbug.tethera.net/status/ )
\r
104 > Both apply cleanly to current master ( d0bd88f )
\r
106 > While Peter's version surely looks simpler (and may work, didn't test atm)
\r
107 > the comments Mark presents makes sense (especially the "subtlety" thing ;)
\r
109 > IMHO Mark's version makes future development "safer" and therefore my
\r
110 > vote (or million of those) goes to id:"87bo8edif8.fsf@qmul.ac.uk"
\r
122 >> On Mon, 13 May 2013, Mark Walters <markwalters1009@gmail.com> wrote:
\r
123 >>> Add NOTMUCH_EXCLUDE_FLAG to notmuch_exclude_t so that it can
\r
124 >>> cover all four values of search --exclude in the cli.
\r
126 >>> Previously the way to avoid any message being marked excluded was to
\r
127 >>> pass in an empty list of excluded tags: since we now have an explicit
\r
128 >>> option we might as well honour it.
\r
130 >>> The enum is in a slightly strange order as the existing FALSE/TRUE
\r
131 >>> options correspond to the new
\r
132 >>> NOTMUCH_EXCLUDE_FLAG/NOTMUCH_EXCLUDE_TRUE options so this means we do
\r
133 >>> not need to bump the version number.
\r
135 >>> Indeed, an example of this is that the cli count and show still use
\r
136 >>> FALSE/TRUE and still work.
\r
139 >>> This is a new version of this single patch. In Peter's version
\r
140 >>> NOTMUCH_EXCLUDE_FLAG and NOTMUCH_EXCLUDE_FALSE were treated as synonyms:
\r
141 >>> this makes them behave in the obvious way and documents them.
\r
143 >>> I think the only subtlety is the enum order mentioned in the commit
\r
144 >>> message. Additionally it would be good to update cli count and show and,
\r
145 >>> at for the latter, it would be good to add an option exclude=all too (so
\r
146 >>> excluded messages are completely omitted). Those should both be simple
\r
147 >>> but we need to decide whether to allow all four options
\r
148 >>> (false/flag/true/all) always or not. Always allowing all 4 is nicely
\r
149 >>> consistent but sometimes redundant. Additionally we would need some
\r
152 >>> I think this patch should go in with the main series as I think it is
\r
153 >>> worth reserving the NOTMUCH_EXCLUDE_FALSE #define/value so that we don't
\r
154 >>> break code in future if we do wish to add it.
\r
162 >>> lib/notmuch.h | 18 ++++++++++++++++--
\r
163 >>> lib/query.cc | 8 +++++---
\r
164 >>> lib/thread.cc | 28 +++++++++++++++-------------
\r
165 >>> notmuch-search.c | 2 +-
\r
166 >>> 4 files changed, 37 insertions(+), 19 deletions(-)
\r
168 >>> diff --git a/lib/notmuch.h b/lib/notmuch.h
\r
169 >>> index 27b43ff..73c85a4 100644
\r
170 >>> --- a/lib/notmuch.h
\r
171 >>> +++ b/lib/notmuch.h
\r
172 >>> @@ -500,10 +500,15 @@ typedef enum {
\r
174 >>> notmuch_query_get_query_string (notmuch_query_t *query);
\r
176 >>> -/* Exclude values for notmuch_query_set_omit_excluded */
\r
177 >>> +/* Exclude values for notmuch_query_set_omit_excluded. The strange
\r
178 >>> + * order is to maintain backward compatibility: the old FALSE/TRUE
\r
179 >>> + * options correspond to the new
\r
180 >>> + * NOTMUCH_EXCLUDE_FLAG/NOTMUCH_EXCLUDE_TRUE options.
\r
183 >>> - NOTMUCH_EXCLUDE_FALSE,
\r
184 >>> + NOTMUCH_EXCLUDE_FLAG,
\r
185 >>> NOTMUCH_EXCLUDE_TRUE,
\r
186 >>> + NOTMUCH_EXCLUDE_FALSE,
\r
187 >>> NOTMUCH_EXCLUDE_ALL
\r
188 >>> } notmuch_exclude_t;
\r
190 >>> @@ -517,6 +522,15 @@ typedef enum {
\r
191 >>> * match in at least one non-excluded message. Otherwise, if set to ALL,
\r
192 >>> * notmuch_query_search_threads will omit excluded messages from all threads.
\r
194 >>> + * If set to FALSE or FLAG then both notmuch_query_search_messages and
\r
195 >>> + * notmuch_query_search_threads will return all matching
\r
196 >>> + * messages/threads regardless of exclude status. If set to FLAG then
\r
197 >>> + * the exclude flag will be set for any excluded message that is
\r
198 >>> + * returned by notmuch_query_search_messages, and the thread counts
\r
199 >>> + * for threads returned by notmuch_query_search_threads will be the
\r
200 >>> + * number of non-excluded messages/matches. Otherwise, if set to
\r
201 >>> + * FALSE, then the exclude status is completely ignored.
\r
203 >>> * The performance difference when calling
\r
204 >>> * notmuch_query_search_messages should be relatively small (and both
\r
205 >>> * should be very fast). However, in some cases,
\r
206 >>> diff --git a/lib/query.cc b/lib/query.cc
\r
207 >>> index 1cc768f..69668a4 100644
\r
208 >>> --- a/lib/query.cc
\r
209 >>> +++ b/lib/query.cc
\r
210 >>> @@ -218,13 +218,15 @@ notmuch_query_search_messages (notmuch_query_t *query)
\r
212 >>> messages->base.excluded_doc_ids = NULL;
\r
214 >>> - if (query->exclude_terms) {
\r
215 >>> + if ((query->omit_excluded != NOTMUCH_EXCLUDE_FALSE) && (query->exclude_terms)) {
\r
216 >>> exclude_query = _notmuch_exclude_tags (query, final_query);
\r
218 >>> - if (query->omit_excluded != NOTMUCH_EXCLUDE_FALSE)
\r
219 >>> + if (query->omit_excluded == NOTMUCH_EXCLUDE_TRUE ||
\r
220 >>> + query->omit_excluded == NOTMUCH_EXCLUDE_ALL)
\r
222 >>> final_query = Xapian::Query (Xapian::Query::OP_AND_NOT,
\r
223 >>> final_query, exclude_query);
\r
225 >>> + } else { /* NOTMUCH_EXCLUDE_FLAG */
\r
226 >>> exclude_query = Xapian::Query (Xapian::Query::OP_AND,
\r
227 >>> exclude_query, final_query);
\r
229 >>> diff --git a/lib/thread.cc b/lib/thread.cc
\r
230 >>> index bc07877..4dcf705 100644
\r
231 >>> --- a/lib/thread.cc
\r
232 >>> +++ b/lib/thread.cc
\r
233 >>> @@ -238,20 +238,22 @@ _thread_add_message (notmuch_thread_t *thread,
\r
234 >>> char *clean_author;
\r
235 >>> notmuch_bool_t message_excluded = FALSE;
\r
237 >>> - for (tags = notmuch_message_get_tags (message);
\r
238 >>> - notmuch_tags_valid (tags);
\r
239 >>> - notmuch_tags_move_to_next (tags))
\r
241 >>> - tag = notmuch_tags_get (tags);
\r
242 >>> - /* Is message excluded? */
\r
243 >>> - for (notmuch_string_node_t *term = exclude_terms->head;
\r
244 >>> - term != NULL;
\r
245 >>> - term = term->next)
\r
246 >>> + if (omit_exclude != NOTMUCH_EXCLUDE_FALSE) {
\r
247 >>> + for (tags = notmuch_message_get_tags (message);
\r
248 >>> + notmuch_tags_valid (tags);
\r
249 >>> + notmuch_tags_move_to_next (tags))
\r
251 >>> - /* We ignore initial 'K'. */
\r
252 >>> - if (strcmp(tag, (term->string + 1)) == 0) {
\r
253 >>> - message_excluded = TRUE;
\r
255 >>> + tag = notmuch_tags_get (tags);
\r
256 >>> + /* Is message excluded? */
\r
257 >>> + for (notmuch_string_node_t *term = exclude_terms->head;
\r
258 >>> + term != NULL;
\r
259 >>> + term = term->next)
\r
261 >>> + /* We ignore initial 'K'. */
\r
262 >>> + if (strcmp(tag, (term->string + 1)) == 0) {
\r
263 >>> + message_excluded = TRUE;
\r
269 >>> diff --git a/notmuch-search.c b/notmuch-search.c
\r
270 >>> index 4323201..a20791a 100644
\r
271 >>> --- a/notmuch-search.c
\r
272 >>> +++ b/notmuch-search.c
\r
273 >>> @@ -411,7 +411,7 @@ notmuch_search_command (notmuch_config_t *config, int argc, char *argv[])
\r
274 >>> for (i = 0; i < search_exclude_tags_length; i++)
\r
275 >>> notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);
\r
276 >>> if (exclude == EXCLUDE_FLAG)
\r
277 >>> - notmuch_query_set_omit_excluded (query, NOTMUCH_EXCLUDE_FALSE);
\r
278 >>> + notmuch_query_set_omit_excluded (query, NOTMUCH_EXCLUDE_FLAG);
\r
279 >>> if (exclude == EXCLUDE_ALL)
\r
280 >>> notmuch_query_set_omit_excluded (query, NOTMUCH_EXCLUDE_ALL);
\r
284 >> _______________________________________________
\r
285 >> notmuch mailing list
\r
286 >> notmuch@notmuchmail.org
\r
287 >> http://notmuchmail.org/mailman/listinfo/notmuch
\r