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 DB18C431FBD for ; Sat, 25 Feb 2012 21:56:06 -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 Kz+qFR0a1LA6 for ; Sat, 25 Feb 2012 21:56:06 -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 232EF431FAE for ; Sat, 25 Feb 2012 21:56:06 -0800 (PST) Received: by wibhi8 with SMTP id hi8so2574099wib.26 for ; Sat, 25 Feb 2012 21:56:04 -0800 (PST) Received-SPF: pass (google.com: domain of markwalters1009@gmail.com designates 10.180.93.4 as permitted sender) client-ip=10.180.93.4; Authentication-Results: mr.google.com; spf=pass (google.com: domain of markwalters1009@gmail.com designates 10.180.93.4 as permitted sender) smtp.mail=markwalters1009@gmail.com; dkim=pass header.i=markwalters1009@gmail.com Received: from mr.google.com ([10.180.93.4]) by 10.180.93.4 with SMTP id cq4mr17546189wib.21.1330235764883 (num_hops = 1); Sat, 25 Feb 2012 21:56:04 -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=32u4Sqkf3c2vTKAu3GWUtRncCIw3Eni0kEUjiTfP6JE=; b=N9bYubZFPh6AE7Vb/7502mSg17QSnpDjbE4ib6VfE/G7R89UUmKz2+owKV57JJNstw VOevf0AfIsftdiK8u2yzToRFe70flz8O5K+Fb7TiAAMUrBNwvHX/5LwgxudZ/85koSW5 ysAk3VsC+Can+EzCycT7o8WKhkizsltkQlmJ0= Received: by 10.180.93.4 with SMTP id cq4mr9148368wib.21.1330157127140; Sat, 25 Feb 2012 00:05:27 -0800 (PST) Received: from localhost (94-192-233-223.zone6.bethere.co.uk. [94.192.233.223]) by mx.google.com with ESMTPS id hs6sm20687559wib.2.2012.02.25.00.05.25 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 25 Feb 2012 00:05:26 -0800 (PST) From: Mark Walters To: notmuch@notmuchmail.org, Austin Clements Subject: [Patch v6 01/13] cli: add --no-exclude option to count and search. Date: Sat, 25 Feb 2012 08:06:32 +0000 Message-Id: <1330157204-26094-2-git-send-email-markwalters1009@gmail.com> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1330157204-26094-1-git-send-email-markwalters1009@gmail.com> References: <1330157204-26094-1-git-send-email-markwalters1009@gmail.com> 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, 26 Feb 2012 05:56:07 -0000 This option turns off the exclusion so all matching messages are returned. We do not need to add this to notmuch-show as that does not (yet) exclude. --- notmuch-count.c | 17 +++++++++++------ notmuch-search.c | 17 +++++++++++------ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/notmuch-count.c b/notmuch-count.c index 63459fb..5364507 100644 --- a/notmuch-count.c +++ b/notmuch-count.c @@ -35,8 +35,7 @@ notmuch_count_command (void *ctx, int argc, char *argv[]) char *query_str; int opt_index; int output = OUTPUT_MESSAGES; - const char **search_exclude_tags; - size_t search_exclude_tags_length; + notmuch_bool_t no_exclude = FALSE; unsigned int i; notmuch_opt_desc_t options[] = { @@ -44,6 +43,7 @@ notmuch_count_command (void *ctx, int argc, char *argv[]) (notmuch_keyword_t []){ { "threads", OUTPUT_THREADS }, { "messages", OUTPUT_MESSAGES }, { 0, 0 } } }, + { NOTMUCH_OPT_BOOLEAN, &no_exclude, "no-exclude", 'd', 0 }, { 0, 0, 0, 0, 0 } }; @@ -78,10 +78,15 @@ 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 (!no_exclude) { + const char **search_exclude_tags; + size_t search_exclude_tags_length; + + 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..d1c5553 100644 --- a/notmuch-search.c +++ b/notmuch-search.c @@ -423,8 +423,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[]) output_t output = OUTPUT_SUMMARY; int offset = 0; int limit = -1; /* unlimited */ - const char **search_exclude_tags; - size_t search_exclude_tags_length; + notmuch_bool_t no_exclude = FALSE; unsigned int i; enum { NOTMUCH_FORMAT_JSON, NOTMUCH_FORMAT_TEXT } @@ -446,6 +445,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[]) { "files", OUTPUT_FILES }, { "tags", OUTPUT_TAGS }, { 0, 0 } } }, + { NOTMUCH_OPT_BOOLEAN, &no_exclude, "no-exclude", 'd', 0 }, { NOTMUCH_OPT_INT, &offset, "offset", 'O', 0 }, { NOTMUCH_OPT_INT, &limit, "limit", 'L', 0 }, { 0, 0, 0, 0, 0 } @@ -493,10 +493,15 @@ 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 (!no_exclude) { + const char **search_exclude_tags; + size_t search_exclude_tags_length; + + 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