]> git.notmuchmail.org Git - notmuch/blobdiff - notmuch-search.c
search: Support automatic tag exclusions
[notmuch] / notmuch-search.c
index 4baab5612efefafdacab08fe8a74eb72e8352cda..8867aabcea9dc12b7359cda0abe79a5d8a990bf3 100644 (file)
@@ -423,6 +423,9 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
     output_t output = OUTPUT_SUMMARY;
     int offset = 0;
     int limit = -1; /* unlimited */
+    const char **auto_exclude_tags;
+    size_t auto_exclude_tags_length;
+    unsigned int i;
 
     enum { NOTMUCH_FORMAT_JSON, NOTMUCH_FORMAT_TEXT }
        format_sel = NOTMUCH_FORMAT_TEXT;
@@ -490,6 +493,11 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
 
     notmuch_query_set_sort (query, sort);
 
+    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) {
     default:
     case OUTPUT_SUMMARY: