[PATCH 3/4] config: only set search.exclude_tags to "deleted; spam; " during setup

Pieter Praet pieter at praet.org
Thu Jan 19 11:19:03 PST 2012


If the 'search.exclude_tags' option is missing from the config file,
its value is automatically set to "deleted;spam;".  Taking PoLS/DWIM
into account, this should probably only happen during setup.

This patch is actually Austin Clements' work:
  id:"20120117203211.GQ16740 at mit.edu"

---
 notmuch-config.c |    8 ++++++--
 test/search      |    1 -
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/notmuch-config.c b/notmuch-config.c
index 687bd76..1d9e842 100644
--- a/notmuch-config.c
+++ b/notmuch-config.c
@@ -361,8 +361,12 @@ notmuch_config_open (void *ctx,
     }
 
     if (notmuch_config_get_search_exclude_tags (config, &tmp) == NULL) {
-	const char *tags[] = { "deleted", "spam" };
-	notmuch_config_set_search_exclude_tags (config, tags, 2);
+	if (is_new) {
+	    const char *tags[] = { "deleted", "spam" };
+	    notmuch_config_set_search_exclude_tags (config, tags, 2);
+	} else {
+	    notmuch_config_set_search_exclude_tags (config, NULL, 0);
+	}
     }
 
     error = NULL;
diff --git a/test/search b/test/search
index 99d94bd..414be35 100755
--- a/test/search
+++ b/test/search
@@ -149,7 +149,6 @@ test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; N
 thread:XXX   2001-01-05 [1/2] Notmuch Test Suite; Not deleted reply (deleted inbox unread)"
 
 test_begin_subtest "Don't exclude \"deleted\" messages from search if not configured"
-test_subtest_known_broken
 notmuch config set search.exclude_tags
 output=$(notmuch search subject:deleted | notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Not deleted (inbox unread)
-- 
1.7.8.1



More information about the notmuch mailing list