unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Mark Walters <markwalters1009@gmail.com>
To: notmuch@notmuchmail.org
Subject: [Patch v7 01/13] cli: add --no-exclude option to count and search.
Date: Thu,  1 Mar 2012 22:30:33 +0000	[thread overview]
Message-ID: <1330641045-27416-2-git-send-email-markwalters1009@gmail.com> (raw)
In-Reply-To: <1330641045-27416-1-git-send-email-markwalters1009@gmail.com>

This option turns off the exclusion so all matching messages are
returned. We do not need to add this to notmuch-show as that does not
(yet) exclude.
---
 notmuch-count.c  |   17 +++++++++++------
 notmuch-search.c |   17 +++++++++++------
 2 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/notmuch-count.c b/notmuch-count.c
index 63459fb..5364507 100644
--- a/notmuch-count.c
+++ b/notmuch-count.c
@@ -35,8 +35,7 @@ notmuch_count_command (void *ctx, int argc, char *argv[])
     char *query_str;
     int opt_index;
     int output = OUTPUT_MESSAGES;
-    const char **search_exclude_tags;
-    size_t search_exclude_tags_length;
+    notmuch_bool_t no_exclude = FALSE;
     unsigned int i;
 
     notmuch_opt_desc_t options[] = {
@@ -44,6 +43,7 @@ notmuch_count_command (void *ctx, int argc, char *argv[])
 	  (notmuch_keyword_t []){ { "threads", OUTPUT_THREADS },
 				  { "messages", OUTPUT_MESSAGES },
 				  { 0, 0 } } },
+	{ NOTMUCH_OPT_BOOLEAN, &no_exclude, "no-exclude", 'd', 0 },
 	{ 0, 0, 0, 0, 0 }
     };
 
@@ -78,10 +78,15 @@ notmuch_count_command (void *ctx, int argc, char *argv[])
 	return 1;
     }
 
-    search_exclude_tags = notmuch_config_get_search_exclude_tags
-	(config, &search_exclude_tags_length);
-    for (i = 0; i < search_exclude_tags_length; i++)
-	notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);
+    if (!no_exclude) {
+	const char **search_exclude_tags;
+	size_t search_exclude_tags_length;
+
+	search_exclude_tags = notmuch_config_get_search_exclude_tags
+	    (config, &search_exclude_tags_length);
+	for (i = 0; i < search_exclude_tags_length; i++)
+	    notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);
+    }
 
     switch (output) {
     case OUTPUT_MESSAGES:
diff --git a/notmuch-search.c b/notmuch-search.c
index 92ce38a..6d6c0e6 100644
--- a/notmuch-search.c
+++ b/notmuch-search.c
@@ -426,8 +426,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
     output_t output = OUTPUT_SUMMARY;
     int offset = 0;
     int limit = -1; /* unlimited */
-    const char **search_exclude_tags;
-    size_t search_exclude_tags_length;
+    notmuch_bool_t no_exclude = FALSE;
     unsigned int i;
 
     enum { NOTMUCH_FORMAT_JSON, NOTMUCH_FORMAT_TEXT }
@@ -449,6 +448,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
 				  { "files", OUTPUT_FILES },
 				  { "tags", OUTPUT_TAGS },
 				  { 0, 0 } } },
+	{ NOTMUCH_OPT_BOOLEAN, &no_exclude, "no-exclude", 'd', 0 },
 	{ NOTMUCH_OPT_INT, &offset, "offset", 'O', 0 },
 	{ NOTMUCH_OPT_INT, &limit, "limit", 'L', 0  },
 	{ 0, 0, 0, 0, 0 }
@@ -496,10 +496,15 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
 
     notmuch_query_set_sort (query, sort);
 
-    search_exclude_tags = notmuch_config_get_search_exclude_tags
-	(config, &search_exclude_tags_length);
-    for (i = 0; i < search_exclude_tags_length; i++)
-	notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);
+    if (!no_exclude) {
+	const char **search_exclude_tags;
+	size_t search_exclude_tags_length;
+
+	search_exclude_tags = notmuch_config_get_search_exclude_tags
+	    (config, &search_exclude_tags_length);
+	for (i = 0; i < search_exclude_tags_length; i++)
+	    notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);
+    }
 
     switch (output) {
     default:
-- 
1.7.2.3

  reply	other threads:[~2012-03-01 22:29 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-01 22:30 [Patch v7 00/13] Add NOTMUCH_MESSAGE_FLAG_EXCLUDED flag Mark Walters
2012-03-01 22:30 ` Mark Walters [this message]
2012-03-01 22:30 ` [Patch v7 02/13] cli: Add --no-exclude to the man pages for search and count Mark Walters
2012-03-01 22:30 ` [Patch v7 03/13] test: add tests for new cli --no-exclude option Mark Walters
2012-03-01 22:30 ` [Patch v7 04/13] lib: Rearrange the exclude code in query.cc Mark Walters
2012-03-01 22:30 ` [Patch v7 05/13] lib: Make notmuch_query_search_messages set the exclude flag Mark Walters
2012-03-01 22:30 ` [Patch v7 06/13] lib: Add the exclude flag to notmuch_query_search_threads Mark Walters
2012-03-01 22:30 ` [Patch v7 07/13] test: update search test to reflect exclude flag Mark Walters
2012-03-01 22:30 ` [Patch v7 08/13] cli: Make notmuch-show respect excludes Mark Walters
2012-03-01 22:30 ` [Patch v7 09/13] test: update tests to reflect the exclude flag Mark Walters
2012-03-01 22:30 ` [Patch v7 10/13] man: update manpage for notmuch-show --no-exclude option Mark Walters
2012-03-01 22:30 ` [Patch v7 11/13] cli: omit excluded messages in results where appropriate Mark Walters
2012-03-01 22:30 ` [Patch v7 12/13] emacs: show: recognize the exclude flag Mark Walters
2012-03-01 22:30 ` [Patch v7 13/13] emacs: notmuch.el ignore excluded matches Mark Walters
2012-03-02 13:03 ` [Patch v7 00/13] Add NOTMUCH_MESSAGE_FLAG_EXCLUDED flag David Bremner
2012-03-02 20:31 ` Mark Walters
2012-03-03  3:42 ` Mark Walters
2012-03-03 12:41   ` 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=1330641045-27416-2-git-send-email-markwalters1009@gmail.com \
    --to=markwalters1009@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).