Rename the option --no-exclude to --with-excluded. Note that this could be implemented by setting notmuch_query_set_with_excluded_messages but it is simpler not to set the exclude tags in the first place (the two methods give identical output). --- man/man1/notmuch-count.1 | 4 ++-- notmuch-count.c | 11 ++++++----- test/count | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/man/man1/notmuch-count.1 b/man/man1/notmuch-count.1 index 805a8ae..5903074 100644 --- a/man/man1/notmuch-count.1 +++ b/man/man1/notmuch-count.1 @@ -41,9 +41,9 @@ Output the number of matching threads. .RS 4 .TP 4 -.BR \-\-no\-exclude +.BR \-\-with\-excluded -Do not exclude the messages matching search.exclude_tags in the config file. +Include messages which match search.exclude_tags in the count. .RE .RE .RE diff --git a/notmuch-count.c b/notmuch-count.c index 46b76ae..b87cdca 100644 --- a/notmuch-count.c +++ b/notmuch-count.c @@ -35,7 +35,7 @@ notmuch_count_command (void *ctx, int argc, char *argv[]) char *query_str; int opt_index; int output = OUTPUT_MESSAGES; - notmuch_bool_t no_exclude = FALSE; + notmuch_bool_t with_excluded = FALSE; unsigned int i; notmuch_opt_desc_t options[] = { @@ -43,7 +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 }, + { NOTMUCH_OPT_BOOLEAN, &with_excluded, "with-excluded", 'd', 0 }, { 0, 0, 0, 0, 0 } }; @@ -78,7 +78,10 @@ notmuch_count_command (void *ctx, int argc, char *argv[]) return 1; } - if (!no_exclude) { + /* If we have --with-excluded we could use + * notmuch_query_set_with_excluded, but it is simpler not to set + * the exclude tags in the first place */ + if (!with_excluded) { const char **search_exclude_tags; size_t search_exclude_tags_length; @@ -88,8 +91,6 @@ notmuch_count_command (void *ctx, int argc, char *argv[]) notmuch_query_add_tag_exclude (query, search_exclude_tags[i]); } - notmuch_query_set_omit_excluded_messages (query, TRUE); - switch (output) { case OUTPUT_MESSAGES: printf ("%u\n", notmuch_query_count_messages (query)); diff --git a/test/count b/test/count index 976fff1..f74413b 100755 --- a/test/count +++ b/test/count @@ -53,9 +53,9 @@ test_expect_equal \ "1" \ "`notmuch count subject:deleted and tag:deleted`" -test_begin_subtest "count \"deleted\" messages, with --no-exclude" +test_begin_subtest "count \"deleted\" messages, with --with-excluded" test_expect_equal \ "3" \ - "`notmuch count --no-exclude subject:deleted`" + "`notmuch count --with-excluded subject:deleted`" test_done -- 1.7.2.3 _______________________________________________ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch