X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=notmuch-count.c;h=46b76ae1d13b9340da505ff2b8471112f50d6c87;hp=f77861eec2af78ea9c154a3d592eb2fc9b4922c1;hb=fc4e5248d29cf7264481cbff82343eade5fcc2ca;hpb=42a907992823030f070fc395a174f779998ca6f5 diff --git a/notmuch-count.c b/notmuch-count.c index f77861ee..46b76ae1 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 **auto_exclude_tags; - size_t auto_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,17 @@ notmuch_count_command (void *ctx, int argc, char *argv[]) return 1; } - auto_exclude_tags = notmuch_config_get_auto_exclude_tags - (config, &auto_exclude_tags_length); - for (i = 0; i < auto_exclude_tags_length; i++) - notmuch_query_add_tag_exclude (query, auto_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]); + } + + notmuch_query_set_omit_excluded_messages (query, TRUE); switch (output) { case OUTPUT_MESSAGES: