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 05ED5429E3B
\r
6 for <notmuch@notmuchmail.org>; Sun, 29 Jan 2012 10:39:00 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\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 WZFb8ycrVYMO for <notmuch@notmuchmail.org>;
\r
18 Sun, 29 Jan 2012 10:38:59 -0800 (PST)
\r
19 Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com
\r
20 [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
21 (No client certificate requested)
\r
22 by olra.theworths.org (Postfix) with ESMTPS id 55AD8429E34
\r
23 for <notmuch@notmuchmail.org>; Sun, 29 Jan 2012 10:38:59 -0800 (PST)
\r
24 Received: by wibhi8 with SMTP id hi8so2994807wib.26
\r
25 for <notmuch@notmuchmail.org>; Sun, 29 Jan 2012 10:38:58 -0800 (PST)
\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
\r
27 h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
\r
28 bh=KsZXXT7EjxGdSzl8HWtbXifUefQMewX0coatYYVLTD8=;
\r
29 b=cwZANVYY3e9qlICQrA5msvLxbmu6xTFYLoAZ8Rrl9uhxyG+YsrbkPScK7XS5Nc5ilq
\r
30 MtYbRInIWXACyxNLvVIvFfhscq8d+MBlnzXOgfszZt6KMIW2ATkc/cebBXMVZWJpkyy9
\r
31 zlusEhq4CR7rEG3wTLvU8lC53kwuVpoz9WiZA=
\r
32 Received: by 10.180.93.194 with SMTP id cw2mr6022968wib.0.1327862338007;
\r
33 Sun, 29 Jan 2012 10:38:58 -0800 (PST)
\r
34 Received: from localhost (94-192-233-223.zone6.bethere.co.uk.
\r
35 [94.192.233.223]) by mx.google.com with ESMTPS id
\r
36 x7sm180589wif.10.2012.01.29.10.38.56 (version=TLSv1/SSLv3 cipher=OTHER); Sun,
\r
37 29 Jan 2012 10:38:57 -0800 (PST)
\r
38 From: Mark Walters <markwalters1009@gmail.com>
\r
39 To: notmuch@notmuchmail.org,
\r
41 Subject: [PATCH 1/7] cli: add --do-not-exclude option to count and search.
\r
42 Date: Sun, 29 Jan 2012 18:39:48 +0000
\r
43 Message-Id: <1327862394-14334-1-git-send-email-markwalters1009@gmail.com>
\r
44 X-Mailer: git-send-email 1.7.2.3
\r
45 In-Reply-To: <8762fu4aqt.fsf@qmul.ac.uk>
\r
46 References: <8762fu4aqt.fsf@qmul.ac.uk>
\r
47 X-BeenThere: notmuch@notmuchmail.org
\r
48 X-Mailman-Version: 2.1.13
\r
50 List-Id: "Use and development of the notmuch mail system."
\r
51 <notmuch.notmuchmail.org>
\r
52 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
53 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
54 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
55 List-Post: <mailto:notmuch@notmuchmail.org>
\r
56 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
57 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
58 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
59 X-List-Received-Date: Sun, 29 Jan 2012 18:39:00 -0000
\r
61 This option turns off the exclusion so all matching messages are
\r
62 returned. We do not need to add this to show as notmuch-show does not
\r
65 notmuch-count.c | 12 ++++++++----
\r
66 notmuch-search.c | 12 ++++++++----
\r
67 2 files changed, 16 insertions(+), 8 deletions(-)
\r
69 diff --git a/notmuch-count.c b/notmuch-count.c
\r
70 index 63459fb..c88975e 100644
\r
71 --- a/notmuch-count.c
\r
72 +++ b/notmuch-count.c
\r
73 @@ -37,6 +37,7 @@ notmuch_count_command (void *ctx, int argc, char *argv[])
\r
74 int output = OUTPUT_MESSAGES;
\r
75 const char **search_exclude_tags;
\r
76 size_t search_exclude_tags_length;
\r
77 + notmuch_bool_t do_not_exclude = FALSE;
\r
80 notmuch_opt_desc_t options[] = {
\r
81 @@ -44,6 +45,7 @@ notmuch_count_command (void *ctx, int argc, char *argv[])
\r
82 (notmuch_keyword_t []){ { "threads", OUTPUT_THREADS },
\r
83 { "messages", OUTPUT_MESSAGES },
\r
85 + { NOTMUCH_OPT_BOOLEAN, &do_not_exclude, "do-not-exclude", 'd', 0 },
\r
89 @@ -78,10 +80,12 @@ notmuch_count_command (void *ctx, int argc, char *argv[])
\r
93 - search_exclude_tags = notmuch_config_get_search_exclude_tags
\r
94 - (config, &search_exclude_tags_length);
\r
95 - for (i = 0; i < search_exclude_tags_length; i++)
\r
96 - notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);
\r
97 + if (!do_not_exclude) {
\r
98 + search_exclude_tags = notmuch_config_get_search_exclude_tags
\r
99 + (config, &search_exclude_tags_length);
\r
100 + for (i = 0; i < search_exclude_tags_length; i++)
\r
101 + notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);
\r
105 case OUTPUT_MESSAGES:
\r
106 diff --git a/notmuch-search.c b/notmuch-search.c
\r
107 index d504051..084dd05 100644
\r
108 --- a/notmuch-search.c
\r
109 +++ b/notmuch-search.c
\r
110 @@ -425,6 +425,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
\r
111 int limit = -1; /* unlimited */
\r
112 const char **search_exclude_tags;
\r
113 size_t search_exclude_tags_length;
\r
114 + notmuch_bool_t do_not_exclude = FALSE;
\r
117 enum { NOTMUCH_FORMAT_JSON, NOTMUCH_FORMAT_TEXT }
\r
118 @@ -446,6 +447,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
\r
119 { "files", OUTPUT_FILES },
\r
120 { "tags", OUTPUT_TAGS },
\r
122 + { NOTMUCH_OPT_BOOLEAN, &do_not_exclude, "do-not-exclude", 'd', 0 },
\r
123 { NOTMUCH_OPT_INT, &offset, "offset", 'O', 0 },
\r
124 { NOTMUCH_OPT_INT, &limit, "limit", 'L', 0 },
\r
126 @@ -493,10 +495,12 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
\r
128 notmuch_query_set_sort (query, sort);
\r
130 - search_exclude_tags = notmuch_config_get_search_exclude_tags
\r
131 - (config, &search_exclude_tags_length);
\r
132 - for (i = 0; i < search_exclude_tags_length; i++)
\r
133 - notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);
\r
134 + if (!do_not_exclude) {
\r
135 + search_exclude_tags = notmuch_config_get_search_exclude_tags
\r
136 + (config, &search_exclude_tags_length);
\r
137 + for (i = 0; i < search_exclude_tags_length; i++)
\r
138 + notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);
\r