]> git.notmuchmail.org Git - notmuch/blobdiff - notmuch-count.c
search: Support automatic tag exclusions
[notmuch] / notmuch-count.c
index 0982f99f3d9ffb2e8e6801bb43208175cb52d5a0..f77861eec2af78ea9c154a3d592eb2fc9b4922c1 100644 (file)
@@ -35,6 +35,9 @@ 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;
+    unsigned int i;
 
     notmuch_opt_desc_t options[] = {
        { NOTMUCH_OPT_KEYWORD, &output, "output", 'o',
@@ -75,6 +78,11 @@ 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]);
+
     switch (output) {
     case OUTPUT_MESSAGES:
        printf ("%u\n", notmuch_query_count_messages (query));