unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Peter Wang <novalazy@gmail.com>
To: notmuch@notmuchmail.org
Subject: [PATCH 7/8] lib: add NOTMUCH_EXCLUDE_FLAG to notmuch_exclude_t
Date: Wed, 20 Jun 2012 23:29:06 +1000	[thread overview]
Message-ID: <1340198947-29370-8-git-send-email-novalazy@gmail.com> (raw)
In-Reply-To: <1340198947-29370-1-git-send-email-novalazy@gmail.com>

Add NOTMUCH_EXCLUDE_FLAG to notmuch_exclude_t so that it can
cover all four values of search --exclude in the cli.
---
 lib/notmuch.h    |    1 +
 lib/query.cc     |    6 ++++--
 notmuch-search.c |    2 +-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/notmuch.h b/lib/notmuch.h
index 1280afd..f4381ae 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -504,6 +504,7 @@ notmuch_query_get_query_string (notmuch_query_t *query);
 typedef enum {
     NOTMUCH_EXCLUDE_FALSE,
     NOTMUCH_EXCLUDE_TRUE,
+    NOTMUCH_EXCLUDE_FLAG,
     NOTMUCH_EXCLUDE_ALL
 } notmuch_exclude_t;
 
diff --git a/lib/query.cc b/lib/query.cc
index f752452..1e0f292 100644
--- a/lib/query.cc
+++ b/lib/query.cc
@@ -221,10 +221,12 @@ notmuch_query_search_messages (notmuch_query_t *query)
 	if (query->exclude_terms) {
 	    exclude_query = _notmuch_exclude_tags (query, final_query);
 
-	    if (query->omit_excluded != NOTMUCH_EXCLUDE_FALSE)
+	    if (query->omit_excluded == NOTMUCH_EXCLUDE_TRUE ||
+		query->omit_excluded == NOTMUCH_EXCLUDE_ALL)
+	    {
 		final_query = Xapian::Query (Xapian::Query::OP_AND_NOT,
 					     final_query, exclude_query);
-	    else {
+	    } else {
 		exclude_query = Xapian::Query (Xapian::Query::OP_AND,
 					   exclude_query, final_query);
 
diff --git a/notmuch-search.c b/notmuch-search.c
index 89b5bf9..027923d 100644
--- a/notmuch-search.c
+++ b/notmuch-search.c
@@ -527,7 +527,7 @@ 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, NOTMUCH_EXCLUDE_FALSE);
+	    notmuch_query_set_omit_excluded (query, NOTMUCH_EXCLUDE_FLAG);
 	if (exclude == EXCLUDE_ALL)
 	    notmuch_query_set_omit_excluded (query, NOTMUCH_EXCLUDE_ALL);
     }
-- 
1.7.4.4

  parent reply	other threads:[~2012-06-20 13:30 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-20 13:28 [PATCH 0/8] search --exclude=all Peter Wang
2012-06-20 13:29 ` [PATCH 1/8] lib: add --exclude=all option Peter Wang
2013-05-11 18:07   ` David Bremner
2012-06-20 13:29 ` [PATCH 2/8] cli: add --exclude=all option to notmuch-search.c Peter Wang
2012-06-20 13:29 ` [PATCH 3/8] test: add tests for search --exclude=all Peter Wang
2012-06-20 13:29 ` [PATCH 4/8] man: clarify search --exclude documentation Peter Wang
2012-06-20 20:08   ` Mark Walters
2012-06-23  2:02     ` Peter Wang
2012-06-23  7:14       ` Mark Walters
2012-06-20 13:29 ` [PATCH 5/8] man: clarify search --exclude=flag Peter Wang
2012-06-20 13:29 ` [PATCH 6/8] man: document search --exclude=all Peter Wang
2012-06-20 13:29 ` Peter Wang [this message]
2012-10-19  5:15   ` [PATCH 7/8] lib: add NOTMUCH_EXCLUDE_FLAG to notmuch_exclude_t Ethan Glasser-Camp
2012-10-19 21:23     ` Ethan Glasser-Camp
2012-10-20 10:04       ` Tomi Ollila
2012-10-21  2:04     ` Peter Wang
2012-10-21 12:10       ` Tomi Ollila
2012-10-21 13:03       ` Ethan Glasser-Camp
2012-06-20 13:29 ` [PATCH 8/8] cli: use notmuch_exclude_t in option parser Peter Wang
2012-07-22  1:18 ` [PATCH v2 4/8] man: clarify search --exclude documentation Peter Wang

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=1340198947-29370-8-git-send-email-novalazy@gmail.com \
    --to=novalazy@gmail.com \
    --cc=notmuch@notmuchmail.org \
    /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).