]> git.cworth.org Git - notmuch/commitdiff
Make exclusion visible again
authorDavid Bremner <bremner@debian.org>
Sat, 3 Mar 2012 12:56:15 +0000 (08:56 -0400)
committerDavid Bremner <bremner@debian.org>
Sat, 3 Mar 2012 15:56:47 +0000 (11:56 -0400)
This reverts

dfee0f9 man: remove search.exclude_tags from notmuch-config.1 for 0.12
e83409d NEWS: revert NEWS item for exclude tags for 0.12
e77b031 config: disable addition of exclude tags for 0.12

NEWS
man/man1/notmuch-config.1
notmuch-config.c
notmuch-setup.c

diff --git a/NEWS b/NEWS
index 4152e7c9e1b8cab87317cda565d44b13105f3f7e..a73991496ae5d6c994224b3678623b02426ef5d9 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,24 @@ Reply to sender
   to all. The feature is available through the new command line option
   --reply-to=(all|sender).
 
+Tag exclusion
+
+  Tags can be automatically excluded from search results by adding them
+  to the new 'search.exclude_tags' option in the Notmuch config file.
+
+  This behaviour can be overridden by explicitly including an excluded
+  tag in your query, for example:
+
+    notmuch search $your_query and tag:$excluded_tag
+
+  Existing users will probably want to run "notmuch setup" again to add
+  the new well-commented [search] section to the configuration file.
+
+  For new configurations, accepting the default setting will cause the
+  tags "deleted" and "spam" to be excluded, equivalent to running:
+
+    notmuch config set search.exclude_tags deleted spam
+
 Mail store folder/file ignore
 
    A new configuration option, `new.ignore`, lets users specify a
index 57eee93b680b46cf044ac4fc5ec9aa7f3c710d29..e62577cc323c32470e7677ce16761c39c1991855 100644 (file)
@@ -83,6 +83,14 @@ will be ignored, regardless of the location in the mail store
 directory hierarchy.
 .RE
 
+.RS 4
+.TP 4
+.B search.exclude_tags
+A list of tags that will be excluded from search results by
+default. Using an excluded tag in a query will override that
+exclusion.
+.RE
+
 .RS 4
 .TP 4
 .B maildir.synchronize_flags
index 61fda3ea4bafd49ef14d075c2cef70c8d5f2a20c..e9b275096acb999103db4b5a68a74f27f0a5dcf1 100644 (file)
@@ -377,7 +377,8 @@ notmuch_config_open (void *ctx,
 
     if (notmuch_config_get_search_exclude_tags (config, &tmp) == NULL) {
        if (is_new) {
-           /* We do not set default search_exclude_tags for 0.12 */
+           const char *tags[] = { "deleted", "spam" };
+           notmuch_config_set_search_exclude_tags (config, tags, 2);
        } else {
            notmuch_config_set_search_exclude_tags (config, NULL, 0);
        }
index 307231d51b55f8ea13c7358839db86cc3f7df4dd..94d0aa7bace6e96a8eb417ace7a71a8a8ed800d5 100644 (file)
@@ -133,6 +133,8 @@ notmuch_setup_command (unused (void *ctx),
     int is_new;
     const char **new_tags;
     size_t new_tags_len;
+    const char **search_exclude_tags;
+    size_t search_exclude_tags_len;
 
 #define prompt(format, ...)                                    \
     do {                                                       \
@@ -209,7 +211,22 @@ notmuch_setup_command (unused (void *ctx),
     }
 
 
-    /* Temporarily remove exclude tag support for 0.12 */
+    search_exclude_tags = notmuch_config_get_search_exclude_tags (config, &search_exclude_tags_len);
+
+    printf ("Tags to exclude when searching messages (separated by spaces) [");
+    print_tag_list (search_exclude_tags, search_exclude_tags_len);
+    prompt ("]: ");
+
+    if (strlen (response)) {
+       GPtrArray *tags = parse_tag_list (ctx, response);
+
+       notmuch_config_set_search_exclude_tags (config,
+                                               (const char **) tags->pdata,
+                                               tags->len);
+
+       g_ptr_array_free (tags, TRUE);
+    }
+
 
     if (! notmuch_config_save (config)) {
        if (is_new)