Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 05ED5429E3B for ; Sun, 29 Jan 2012 10:39:00 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0.201 X-Spam-Level: X-Spam-Status: No, score=0.201 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001, 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 WZFb8ycrVYMO for ; Sun, 29 Jan 2012 10:38:59 -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 55AD8429E34 for ; Sun, 29 Jan 2012 10:38:59 -0800 (PST) Received: by wibhi8 with SMTP id hi8so2994807wib.26 for ; Sun, 29 Jan 2012 10:38:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=KsZXXT7EjxGdSzl8HWtbXifUefQMewX0coatYYVLTD8=; b=cwZANVYY3e9qlICQrA5msvLxbmu6xTFYLoAZ8Rrl9uhxyG+YsrbkPScK7XS5Nc5ilq MtYbRInIWXACyxNLvVIvFfhscq8d+MBlnzXOgfszZt6KMIW2ATkc/cebBXMVZWJpkyy9 zlusEhq4CR7rEG3wTLvU8lC53kwuVpoz9WiZA= Received: by 10.180.93.194 with SMTP id cw2mr6022968wib.0.1327862338007; Sun, 29 Jan 2012 10:38:58 -0800 (PST) Received: from localhost (94-192-233-223.zone6.bethere.co.uk. [94.192.233.223]) by mx.google.com with ESMTPS id x7sm180589wif.10.2012.01.29.10.38.56 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 29 Jan 2012 10:38:57 -0800 (PST) From: Mark Walters To: notmuch@notmuchmail.org, amdragon@MIT.EDU Subject: [PATCH 1/7] cli: add --do-not-exclude option to count and search. Date: Sun, 29 Jan 2012 18:39:48 +0000 Message-Id: <1327862394-14334-1-git-send-email-markwalters1009@gmail.com> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <8762fu4aqt.fsf@qmul.ac.uk> References: <8762fu4aqt.fsf@qmul.ac.uk> 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: Sun, 29 Jan 2012 18:39:00 -0000 This option turns off the exclusion so all matching messages are returned. We do not need to add this to show as notmuch-show does not (yet) exclude. --- notmuch-count.c | 12 ++++++++---- notmuch-search.c | 12 ++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/notmuch-count.c b/notmuch-count.c index 63459fb..c88975e 100644 --- a/notmuch-count.c +++ b/notmuch-count.c @@ -37,6 +37,7 @@ notmuch_count_command (void *ctx, int argc, char *argv[]) int output = OUTPUT_MESSAGES; const char **search_exclude_tags; size_t search_exclude_tags_length; + notmuch_bool_t do_not_exclude = FALSE; unsigned int i; notmuch_opt_desc_t options[] = { @@ -44,6 +45,7 @@ notmuch_count_command (void *ctx, int argc, char *argv[]) (notmuch_keyword_t []){ { "threads", OUTPUT_THREADS }, { "messages", OUTPUT_MESSAGES }, { 0, 0 } } }, + { NOTMUCH_OPT_BOOLEAN, &do_not_exclude, "do-not-exclude", 'd', 0 }, { 0, 0, 0, 0, 0 } }; @@ -78,10 +80,12 @@ notmuch_count_command (void *ctx, int argc, char *argv[]) return 1; } - search_exclude_tags = notmuch_config_get_search_exclude_tags - (config, &search_exclude_tags_length); - for (i = 0; i < search_exclude_tags_length; i++) - notmuch_query_add_tag_exclude (query, search_exclude_tags[i]); + if (!do_not_exclude) { + search_exclude_tags = notmuch_config_get_search_exclude_tags + (config, &search_exclude_tags_length); + for (i = 0; i < search_exclude_tags_length; i++) + notmuch_query_add_tag_exclude (query, search_exclude_tags[i]); + } switch (output) { case OUTPUT_MESSAGES: diff --git a/notmuch-search.c b/notmuch-search.c index d504051..084dd05 100644 --- a/notmuch-search.c +++ b/notmuch-search.c @@ -425,6 +425,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[]) int limit = -1; /* unlimited */ const char **search_exclude_tags; size_t search_exclude_tags_length; + notmuch_bool_t do_not_exclude = FALSE; unsigned int i; enum { NOTMUCH_FORMAT_JSON, NOTMUCH_FORMAT_TEXT } @@ -446,6 +447,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[]) { "files", OUTPUT_FILES }, { "tags", OUTPUT_TAGS }, { 0, 0 } } }, + { NOTMUCH_OPT_BOOLEAN, &do_not_exclude, "do-not-exclude", 'd', 0 }, { NOTMUCH_OPT_INT, &offset, "offset", 'O', 0 }, { NOTMUCH_OPT_INT, &limit, "limit", 'L', 0 }, { 0, 0, 0, 0, 0 } @@ -493,10 +495,12 @@ notmuch_search_command (void *ctx, int argc, char *argv[]) notmuch_query_set_sort (query, sort); - search_exclude_tags = notmuch_config_get_search_exclude_tags - (config, &search_exclude_tags_length); - for (i = 0; i < search_exclude_tags_length; i++) - notmuch_query_add_tag_exclude (query, search_exclude_tags[i]); + if (!do_not_exclude) { + search_exclude_tags = notmuch_config_get_search_exclude_tags + (config, &search_exclude_tags_length); + for (i = 0; i < search_exclude_tags_length; i++) + notmuch_query_add_tag_exclude (query, search_exclude_tags[i]); + } switch (output) { default: -- 1.7.2.3