From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 92F4642119F for ; Sun, 22 Jan 2012 20:24:52 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ehWXUuoVmuKZ for ; Sun, 22 Jan 2012 20:24:52 -0800 (PST) Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id EF5E742119C for ; Sun, 22 Jan 2012 20:24:51 -0800 (PST) Received: by wibhi8 with SMTP id hi8so305684wib.26 for ; Sun, 22 Jan 2012 20:24:50 -0800 (PST) Received: by 10.180.83.72 with SMTP id o8mr11414755wiy.22.1327292690754; Sun, 22 Jan 2012 20:24:50 -0800 (PST) Received: from localhost ([109.131.95.182]) by mx.google.com with ESMTPS id eq5sm36881567wib.2.2012.01.22.20.24.50 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 22 Jan 2012 20:24:50 -0800 (PST) From: Pieter Praet To: Austin Clements Subject: [PATCH v2 3/6] config: only exclude messages if 'search.exclude_tags' is explicitly set Date: Mon, 23 Jan 2012 05:22:34 +0100 Message-Id: <1327292557-7701-3-git-send-email-pieter@praet.org> X-Mailer: git-send-email 1.7.8.1 In-Reply-To: <87obtvaw8h.fsf@praet.org> References: <87obtvaw8h.fsf@praet.org> Cc: Notmuch Mail X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jan 2012 04:24:52 -0000 Currently, the 'search.exclude_tags' option is automatically set to "deleted;spam;" if it's missing from the config file. This violates the Principle of Least Surprise, so *only* set 'search.exclude_tags' to "deleted;spam;" if we didn't find a configuration file at all. This patch is actually Austin Clements' work: id:"20120117203211.GQ16740@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 39da888..0ded6d7 100644 --- a/notmuch-config.c +++ b/notmuch-config.c @@ -362,8 +362,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