From: Mark Walters <markwalters1009@gmail.com>
To: notmuch@notmuchmail.org, novalazy@gmail.com
Subject: [WIP 2/2] cli: add --exclude=all option to notmuch-search.c
Date: Sun, 17 Jun 2012 08:27:26 +0100 [thread overview]
Message-ID: <1339918046-3448-2-git-send-email-markwalters1009@gmail.com> (raw)
In-Reply-To: <1339918046-3448-1-git-send-email-markwalters1009@gmail.com>
Add a --exclude=all option to notmuch search.
---
notmuch-search.c | 8 ++++++--
test/excludes | 5 +++++
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/notmuch-search.c b/notmuch-search.c
index 3be296d..89b5bf9 100644
--- a/notmuch-search.c
+++ b/notmuch-search.c
@@ -420,6 +420,7 @@ enum {
EXCLUDE_TRUE,
EXCLUDE_FALSE,
EXCLUDE_FLAG,
+ EXCLUDE_ALL
};
int
@@ -461,6 +462,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
(notmuch_keyword_t []){ { "true", EXCLUDE_TRUE },
{ "false", EXCLUDE_FALSE },
{ "flag", EXCLUDE_FLAG },
+ { "all", EXCLUDE_ALL },
{ 0, 0 } } },
{ NOTMUCH_OPT_INT, &offset, "offset", 'O', 0 },
{ NOTMUCH_OPT_INT, &limit, "limit", 'L', 0 },
@@ -516,7 +518,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
exclude = EXCLUDE_FALSE;
}
- if (exclude == EXCLUDE_TRUE || exclude == EXCLUDE_FLAG) {
+ if (exclude != EXCLUDE_FALSE) {
const char **search_exclude_tags;
size_t search_exclude_tags_length;
@@ -525,7 +527,9 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
for (i = 0; i < search_exclude_tags_length; i++)
notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);
if (exclude == EXCLUDE_FLAG)
- notmuch_query_set_omit_excluded (query, FALSE);
+ notmuch_query_set_omit_excluded (query, NOTMUCH_EXCLUDE_FALSE);
+ if (exclude == EXCLUDE_ALL)
+ notmuch_query_set_omit_excluded (query, NOTMUCH_EXCLUDE_ALL);
}
switch (output) {
diff --git a/test/excludes b/test/excludes
index 24d653e..7be8d79 100755
--- a/test/excludes
+++ b/test/excludes
@@ -166,6 +166,11 @@ ${matching_message_ids[3]}
${matching_message_ids[4]}
${matching_message_ids[5]}"
+test_begin_subtest "Search, exclude=all (thread summary)"
+output=$(notmuch search --exclude=all tag:test | notmuch_search_sanitize)
+test_expect_equal "$output" "thread:XXX 2001-01-05 [1/5] Notmuch Test Suite; Some messages excluded: single non-excluded match: reply 4 (inbox test unread)
+thread:XXX 2001-01-05 [1/6] Notmuch Test Suite; No messages excluded: single match: reply 3 (inbox test unread)"
+
test_begin_subtest "Search, default exclusion: tag in query (thread summary)"
output=$(notmuch search tag:test and tag:deleted | notmuch_search_sanitize)
test_expect_equal "$output" "thread:XXX 2001-01-05 [1/6] Notmuch Test Suite; All messages excluded: single match: reply 2 (deleted inbox test unread)
--
1.7.9.1
next prev parent reply other threads:[~2012-06-17 7:27 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-28 14:00 search summary and exclusions Peter Wang
2012-05-28 17:03 ` Jameson Graef Rollins
2012-05-29 4:01 ` Peter Wang
2012-05-29 8:37 ` Mark Walters
2012-05-29 15:00 ` Jameson Graef Rollins
2012-05-30 3:07 ` Peter Wang
2012-05-30 3:58 ` Jameson Graef Rollins
2012-05-30 7:49 ` Mark Walters
2012-06-17 7:03 ` Peter Wang
2012-06-17 7:22 ` Mark Walters
2012-06-17 7:27 ` [WIP 1/2] lib: add --exclude=all option Mark Walters
2012-06-17 7:27 ` Mark Walters [this message]
2012-05-28 18:54 ` search summary and exclusions Mark Walters
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1339918046-3448-2-git-send-email-markwalters1009@gmail.com \
--to=markwalters1009@gmail.com \
--cc=notmuch@notmuchmail.org \
--cc=novalazy@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).