From: David Bremner Date: Sat, 3 Mar 2012 12:56:15 +0000 (-0400) Subject: Make exclusion visible again X-Git-Tag: 0.13_rc1~163 X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=commitdiff_plain;h=4b3af0e4443f88f302f09a7a6099a31103d862d6 Make exclusion visible again 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 --- diff --git a/NEWS b/NEWS index 4152e7c9..a7399149 100644 --- 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 diff --git a/man/man1/notmuch-config.1 b/man/man1/notmuch-config.1 index 57eee93b..e62577cc 100644 --- a/man/man1/notmuch-config.1 +++ b/man/man1/notmuch-config.1 @@ -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 diff --git a/notmuch-config.c b/notmuch-config.c index 61fda3ea..e9b27509 100644 --- a/notmuch-config.c +++ b/notmuch-config.c @@ -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); } diff --git a/notmuch-setup.c b/notmuch-setup.c index 307231d5..94d0aa7b 100644 --- a/notmuch-setup.c +++ b/notmuch-setup.c @@ -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)