[Patch v7 01/13] cli: add --no-exclude option to count and search.
authorMark Walters <markwalters1009@gmail.com>
Thu, 1 Mar 2012 22:30:33 +0000 (22:30 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:45:08 +0000 (09:45 -0800)
e1/55eba2f4f78b9595b991db59aba09f305901c6 [new file with mode: 0644]

diff --git a/e1/55eba2f4f78b9595b991db59aba09f305901c6 b/e1/55eba2f4f78b9595b991db59aba09f305901c6
new file mode 100644 (file)
index 0000000..65c3fcb
--- /dev/null
@@ -0,0 +1,166 @@
+Return-Path: <markwalters1009@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 295B0431FD5\r
+       for <notmuch@notmuchmail.org>; Thu,  1 Mar 2012 14:29:08 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.201\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
+       RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id TWWHZ50v4M8v for <notmuch@notmuchmail.org>;\r
+       Thu,  1 Mar 2012 14:29:07 -0800 (PST)\r
+Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com\r
+       [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 64998431FAE\r
+       for <notmuch@notmuchmail.org>; Thu,  1 Mar 2012 14:29:07 -0800 (PST)\r
+Received: by wico1 with SMTP id o1so305757wic.26\r
+       for <notmuch@notmuchmail.org>; Thu, 01 Mar 2012 14:29:06 -0800 (PST)\r
+Received-SPF: pass (google.com: domain of markwalters1009@gmail.com designates\r
+       10.180.87.8 as permitted sender) client-ip=10.180.87.8; \r
+Authentication-Results: mr.google.com; spf=pass (google.com: domain of\r
+       markwalters1009@gmail.com designates 10.180.87.8 as permitted\r
+       sender) smtp.mail=markwalters1009@gmail.com;\r
+       dkim=pass header.i=markwalters1009@gmail.com\r
+Received: from mr.google.com ([10.180.87.8])\r
+       by 10.180.87.8 with SMTP id t8mr6519078wiz.15.1330640946434 (num_hops =\r
+       1); Thu, 01 Mar 2012 14:29:06 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
+       bh=zzl454coS2NIx5EXcdeh/hMrVJ/yjbqcmYG6U/x2PIk=;\r
+       b=jKlIlsxhZVRm+GL3jDlUcuNgGu31KQrFpA3XVkCOWJUsefwEagLsbNwQ3HJOOWuWR9\r
+       RWTCYlTuas26Ol0aTUGoLZbvefgEAR9o1/DMcKTNmNcRONtx8Ge8igy+/twq5r/0Uicg\r
+       9XD1zxTM6XqPr+z333b3zpufLUA1b4Mz5fh0rTfLrg6XSEx83kjXUlZu1NUJL/KVYEdc\r
+       FcH0febZZXKPN1zozQX3oTP5eWv/emoyc2i2WR9Wmbg6vcXpM/J3tKLOUv+gfr5Y/ikd\r
+       +/6td/6onNaTz+UQaErftPll18Pcph2nNOSM6oOmJXoCrS0fDRsEMMt2GxOCaiFdC9d0\r
+       hayQ==\r
+Received: by 10.180.87.8 with SMTP id t8mr5261605wiz.15.1330640946335;\r
+       Thu, 01 Mar 2012 14:29:06 -0800 (PST)\r
+Received: from localhost (94-192-233-223.zone6.bethere.co.uk.\r
+ [94.192.233.223])     by mx.google.com with ESMTPS id\r
+ cc3sm16539306wib.7.2012.03.01.14.29.04        (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Thu, 01 Mar 2012 14:29:05 -0800 (PST)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [Patch v7 01/13] cli: add --no-exclude option to count and search.\r
+Date: Thu,  1 Mar 2012 22:30:33 +0000\r
+Message-Id: <1330641045-27416-2-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.2.3\r
+In-Reply-To: <1330641045-27416-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1330641045-27416-1-git-send-email-markwalters1009@gmail.com>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Thu, 01 Mar 2012 22:29:08 -0000\r
+\r
+This option turns off the exclusion so all matching messages are\r
+returned. We do not need to add this to notmuch-show as that does not\r
+(yet) exclude.\r
+---\r
+ notmuch-count.c  |   17 +++++++++++------\r
+ notmuch-search.c |   17 +++++++++++------\r
+ 2 files changed, 22 insertions(+), 12 deletions(-)\r
+\r
+diff --git a/notmuch-count.c b/notmuch-count.c\r
+index 63459fb..5364507 100644\r
+--- a/notmuch-count.c\r
++++ b/notmuch-count.c\r
+@@ -35,8 +35,7 @@ notmuch_count_command (void *ctx, int argc, char *argv[])\r
+     char *query_str;\r
+     int opt_index;\r
+     int output = OUTPUT_MESSAGES;\r
+-    const char **search_exclude_tags;\r
+-    size_t search_exclude_tags_length;\r
++    notmuch_bool_t no_exclude = FALSE;\r
+     unsigned int i;\r
+ \r
+     notmuch_opt_desc_t options[] = {\r
+@@ -44,6 +43,7 @@ notmuch_count_command (void *ctx, int argc, char *argv[])\r
+         (notmuch_keyword_t []){ { "threads", OUTPUT_THREADS },\r
+                                 { "messages", OUTPUT_MESSAGES },\r
+                                 { 0, 0 } } },\r
++      { NOTMUCH_OPT_BOOLEAN, &no_exclude, "no-exclude", 'd', 0 },\r
+       { 0, 0, 0, 0, 0 }\r
+     };\r
+ \r
+@@ -78,10 +78,15 @@ notmuch_count_command (void *ctx, int argc, char *argv[])\r
+       return 1;\r
+     }\r
+ \r
+-    search_exclude_tags = notmuch_config_get_search_exclude_tags\r
+-      (config, &search_exclude_tags_length);\r
+-    for (i = 0; i < search_exclude_tags_length; i++)\r
+-      notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);\r
++    if (!no_exclude) {\r
++      const char **search_exclude_tags;\r
++      size_t search_exclude_tags_length;\r
++\r
++      search_exclude_tags = notmuch_config_get_search_exclude_tags\r
++          (config, &search_exclude_tags_length);\r
++      for (i = 0; i < search_exclude_tags_length; i++)\r
++          notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);\r
++    }\r
+ \r
+     switch (output) {\r
+     case OUTPUT_MESSAGES:\r
+diff --git a/notmuch-search.c b/notmuch-search.c\r
+index 92ce38a..6d6c0e6 100644\r
+--- a/notmuch-search.c\r
++++ b/notmuch-search.c\r
+@@ -426,8 +426,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[])\r
+     output_t output = OUTPUT_SUMMARY;\r
+     int offset = 0;\r
+     int limit = -1; /* unlimited */\r
+-    const char **search_exclude_tags;\r
+-    size_t search_exclude_tags_length;\r
++    notmuch_bool_t no_exclude = FALSE;\r
+     unsigned int i;\r
+ \r
+     enum { NOTMUCH_FORMAT_JSON, NOTMUCH_FORMAT_TEXT }\r
+@@ -449,6 +448,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[])\r
+                                 { "files", OUTPUT_FILES },\r
+                                 { "tags", OUTPUT_TAGS },\r
+                                 { 0, 0 } } },\r
++      { NOTMUCH_OPT_BOOLEAN, &no_exclude, "no-exclude", 'd', 0 },\r
+       { NOTMUCH_OPT_INT, &offset, "offset", 'O', 0 },\r
+       { NOTMUCH_OPT_INT, &limit, "limit", 'L', 0  },\r
+       { 0, 0, 0, 0, 0 }\r
+@@ -496,10 +496,15 @@ notmuch_search_command (void *ctx, int argc, char *argv[])\r
+ \r
+     notmuch_query_set_sort (query, sort);\r
+ \r
+-    search_exclude_tags = notmuch_config_get_search_exclude_tags\r
+-      (config, &search_exclude_tags_length);\r
+-    for (i = 0; i < search_exclude_tags_length; i++)\r
+-      notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);\r
++    if (!no_exclude) {\r
++      const char **search_exclude_tags;\r
++      size_t search_exclude_tags_length;\r
++\r
++      search_exclude_tags = notmuch_config_get_search_exclude_tags\r
++          (config, &search_exclude_tags_length);\r
++      for (i = 0; i < search_exclude_tags_length; i++)\r
++          notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);\r
++    }\r
+ \r
+     switch (output) {\r
+     default:\r
+-- \r
+1.7.2.3\r
+\r