From 6d954dd2591128f1d1847217b2de76a73412d4d1 Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Thu, 1 Mar 2012 22:30:33 +0000 Subject: [PATCH] [Patch v7 01/13] cli: add --no-exclude option to count and search. --- e1/55eba2f4f78b9595b991db59aba09f305901c6 | 166 ++++++++++++++++++++++ 1 file changed, 166 insertions(+) create mode 100644 e1/55eba2f4f78b9595b991db59aba09f305901c6 diff --git a/e1/55eba2f4f78b9595b991db59aba09f305901c6 b/e1/55eba2f4f78b9595b991db59aba09f305901c6 new file mode 100644 index 000000000..65c3fcb47 --- /dev/null +++ b/e1/55eba2f4f78b9595b991db59aba09f305901c6 @@ -0,0 +1,166 @@ +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 295B0431FD5 + for ; Thu, 1 Mar 2012 14:29:08 -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 TWWHZ50v4M8v for ; + Thu, 1 Mar 2012 14:29:07 -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 64998431FAE + for ; Thu, 1 Mar 2012 14:29:07 -0800 (PST) +Received: by wico1 with SMTP id o1so305757wic.26 + for ; Thu, 01 Mar 2012 14:29:06 -0800 (PST) +Received-SPF: pass (google.com: domain of markwalters1009@gmail.com designates + 10.180.87.8 as permitted sender) client-ip=10.180.87.8; +Authentication-Results: mr.google.com; spf=pass (google.com: domain of + markwalters1009@gmail.com designates 10.180.87.8 as permitted + sender) smtp.mail=markwalters1009@gmail.com; + dkim=pass header.i=markwalters1009@gmail.com +Received: from mr.google.com ([10.180.87.8]) + by 10.180.87.8 with SMTP id t8mr6519078wiz.15.1330640946434 (num_hops = + 1); Thu, 01 Mar 2012 14:29:06 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; + bh=zzl454coS2NIx5EXcdeh/hMrVJ/yjbqcmYG6U/x2PIk=; + b=jKlIlsxhZVRm+GL3jDlUcuNgGu31KQrFpA3XVkCOWJUsefwEagLsbNwQ3HJOOWuWR9 + RWTCYlTuas26Ol0aTUGoLZbvefgEAR9o1/DMcKTNmNcRONtx8Ge8igy+/twq5r/0Uicg + 9XD1zxTM6XqPr+z333b3zpufLUA1b4Mz5fh0rTfLrg6XSEx83kjXUlZu1NUJL/KVYEdc + FcH0febZZXKPN1zozQX3oTP5eWv/emoyc2i2WR9Wmbg6vcXpM/J3tKLOUv+gfr5Y/ikd + +/6td/6onNaTz+UQaErftPll18Pcph2nNOSM6oOmJXoCrS0fDRsEMMt2GxOCaiFdC9d0 + hayQ== +Received: by 10.180.87.8 with SMTP id t8mr5261605wiz.15.1330640946335; + Thu, 01 Mar 2012 14:29:06 -0800 (PST) +Received: from localhost (94-192-233-223.zone6.bethere.co.uk. + [94.192.233.223]) by mx.google.com with ESMTPS id + cc3sm16539306wib.7.2012.03.01.14.29.04 (version=TLSv1/SSLv3 cipher=OTHER); + Thu, 01 Mar 2012 14:29:05 -0800 (PST) +From: Mark Walters +To: notmuch@notmuchmail.org +Subject: [Patch v7 01/13] cli: add --no-exclude option to count and search. +Date: Thu, 1 Mar 2012 22:30:33 +0000 +Message-Id: <1330641045-27416-2-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 1.7.2.3 +In-Reply-To: <1330641045-27416-1-git-send-email-markwalters1009@gmail.com> +References: <1330641045-27416-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: Thu, 01 Mar 2012 22:29:08 -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 92ce38a..6d6c0e6 100644 +--- a/notmuch-search.c ++++ b/notmuch-search.c +@@ -426,8 +426,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 } +@@ -449,6 +448,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 } +@@ -496,10 +496,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 + -- 2.26.2