--- /dev/null
+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 02D2F431FD6\r
+ for <notmuch@notmuchmail.org>; Fri, 6 Apr 2012 05:49:26 -0700 (PDT)\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 LUAhWBctxoRn for <notmuch@notmuchmail.org>;\r
+ Fri, 6 Apr 2012 05:49:23 -0700 (PDT)\r
+Received: from mail-wg0-f45.google.com (mail-wg0-f45.google.com\r
+ [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client\r
+ certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
+ 8341E431FDC for <notmuch@notmuchmail.org>; Fri, 6 Apr 2012 05:49:19 -0700\r
+ (PDT)\r
+Received: by mail-wg0-f45.google.com with SMTP id dt14so188823wgb.2\r
+ for <notmuch@notmuchmail.org>; Fri, 06 Apr 2012 05:49:19 -0700 (PDT)\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=RNjegDaofYgFUQpzYcXKNg4I08qTfgYpkZy4yVH/O1g=;\r
+ b=V2ajQwvkc7QYrk4Zl4lRN11qCfytmafMy0ZN54TQ5AQbnF7bDFTGJMuydXRP2Vxj6u\r
+ uHbImD+Xj4vV8KtP0iec8NlgpQh7bwgBZSmfSrXmFTpF0ntnTinLSI1ORlDKoQD6fQ4B\r
+ Sm/sC8UO2am0lhTB+6jELgMee2Kp2MdO2Z7MJpjTT/9SaNsExtua0V5QETZL06IWJpNr\r
+ 2Ma3WfAU3UiaL3iWL9Ow2vRVy75zbsz82nEmGaaqvwnot2q8ui0wIazDi9+fepI2WVAg\r
+ xeZ6aFDICnoP9CKnb1qyvrh1/q2PKbA7zL4p05uAiQ0CtR/+V7kQ8+gtwHYuD88DsRSJ\r
+ xeTg==\r
+Received: by 10.180.94.33 with SMTP id cz1mr11793294wib.13.1333716558850;\r
+ Fri, 06 Apr 2012 05:49:18 -0700 (PDT)\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
+ l5sm6130631wia.11.2012.04.06.05.49.17 (version=TLSv1/SSLv3 cipher=OTHER);\r
+ Fri, 06 Apr 2012 05:49:18 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v3 3/6] cli: move search to the new --exclude= naming scheme.\r
+Date: Fri, 6 Apr 2012 13:49:08 +0100\r
+Message-Id: <1333716551-29153-4-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\r
+In-Reply-To: <1333716551-29153-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1333716551-29153-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: Fri, 06 Apr 2012 12:49:26 -0000\r
+\r
+This commit replaces the --no-exclude option with a\r
+--exclude=(true|false|flag) option. The default is to omit the\r
+excluded messages.\r
+\r
+The flag option only makes sense if output=summary (as otherwise there\r
+is nowhere to print the flag). In summary output exclude=false and\r
+exclude=flag give almost identical output:\r
+they differ in that with the exclude=flag option the match count\r
+(i.e., the x in [x/n] in the output) is the number of matching\r
+non-excluded messages rather than the number of matching messages.\r
+\r
+Note this changes the default for output=summary when no --exclude=\r
+option is given: it used to default to flag and now defaults to true\r
+(i.e. omit excluded messages). This is neccesary to keep the cli\r
+output uncluttered and for speed reasons.\r
+---\r
+ man/man1/notmuch-search.1 | 12 +++++++++---\r
+ notmuch-search.c | 32 +++++++++++++++++++++++---------\r
+ 2 files changed, 32 insertions(+), 12 deletions(-)\r
+\r
+diff --git a/man/man1/notmuch-search.1 b/man/man1/notmuch-search.1\r
+index 06d81a6..ebb61fc 100644\r
+--- a/man/man1/notmuch-search.1\r
++++ b/man/man1/notmuch-search.1\r
+@@ -114,9 +114,15 @@ Limit the number of displayed results to N.\r
+ \r
+ .RS 4\r
+ .TP 4\r
+-.BR \-\-no\-exclude\r
+-\r
+-Do not exclude the messages matching search.exclude_tags in the config file.\r
++.BR \-\-exclude=(true|false|flag)\r
++\r
++Specify whether to omit messages matching search.tag_exclude from the\r
++search results (the default) or not. The extra option\r
++.B flag\r
++only has an effect when\r
++.B --output=summary\r
++In this case all matching threads are returned but the "match count"\r
++is the number of matching non-excluded messages in the thread.\r
+ .RE\r
+ \r
+ .SH SEE ALSO\r
+diff --git a/notmuch-search.c b/notmuch-search.c\r
+index f6061e4..1cc8430 100644\r
+--- a/notmuch-search.c\r
++++ b/notmuch-search.c\r
+@@ -210,9 +210,6 @@ do_search_threads (const search_format_t *format,\r
+ int first_thread = 1;\r
+ int i;\r
+ \r
+- if (output == OUTPUT_THREADS)\r
+- notmuch_query_set_omit_excluded_messages (query, TRUE);\r
+-\r
+ if (offset < 0) {\r
+ offset += notmuch_query_count_threads (query);\r
+ if (offset < 0)\r
+@@ -303,8 +300,6 @@ do_search_messages (const search_format_t *format,\r
+ int first_message = 1;\r
+ int i;\r
+ \r
+- notmuch_query_set_omit_excluded_messages (query, TRUE);\r
+-\r
+ if (offset < 0) {\r
+ offset += notmuch_query_count_messages (query);\r
+ if (offset < 0)\r
+@@ -376,7 +371,6 @@ do_search_tags (notmuch_database_t *notmuch,\r
+ const char *tag;\r
+ int first_tag = 1;\r
+ \r
+- notmuch_query_set_omit_excluded_messages (query, TRUE);\r
+ /* should the following only special case if no excluded terms\r
+ * specified? */\r
+ \r
+@@ -422,6 +416,12 @@ do_search_tags (notmuch_database_t *notmuch,\r
+ return 0;\r
+ }\r
+ \r
++enum {\r
++ EXCLUDE_TRUE,\r
++ EXCLUDE_FALSE,\r
++ EXCLUDE_FLAG,\r
++};\r
++\r
+ int\r
+ notmuch_search_command (void *ctx, int argc, char *argv[])\r
+ {\r
+@@ -435,7 +435,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
+- notmuch_bool_t no_exclude = FALSE;\r
++ int exclude = EXCLUDE_TRUE;\r
+ unsigned int i;\r
+ \r
+ enum { NOTMUCH_FORMAT_JSON, NOTMUCH_FORMAT_TEXT }\r
+@@ -457,7 +457,11 @@ 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_KEYWORD, &exclude, "exclude", 'x',\r
++ (notmuch_keyword_t []){ { "true", EXCLUDE_TRUE },\r
++ { "false", EXCLUDE_FALSE },\r
++ { "flag", EXCLUDE_FLAG },\r
++ { 0, 0 } } },\r
+ { NOTMUCH_OPT_INT, &offset, "offset", 'O', 0 },\r
+ { NOTMUCH_OPT_INT, &limit, "limit", 'L', 0 },\r
+ { 0, 0, 0, 0, 0 }\r
+@@ -505,7 +509,15 @@ notmuch_search_command (void *ctx, int argc, char *argv[])\r
+ \r
+ notmuch_query_set_sort (query, sort);\r
+ \r
+- if (!no_exclude) {\r
++ if (exclude == EXCLUDE_FLAG && output != OUTPUT_SUMMARY) {\r
++ /* If we are not doing summary output there is nowhere to\r
++ * print the excluded flag so fall back on including the\r
++ * excluded messages. */\r
++ fprintf (stderr, "Warning: this output format cannot flag excluded messages.\n");\r
++ exclude = EXCLUDE_FALSE;\r
++ }\r
++\r
++ if (exclude == EXCLUDE_TRUE || exclude == EXCLUDE_FLAG) {\r
+ const char **search_exclude_tags;\r
+ size_t search_exclude_tags_length;\r
+ \r
+@@ -513,6 +525,8 @@ notmuch_search_command (void *ctx, int argc, char *argv[])\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 (exclude == EXCLUDE_FLAG)\r
++ notmuch_query_set_omit_excluded (query, FALSE);\r
+ }\r
+ \r
+ switch (output) {\r
+-- \r
+1.7.9.1\r
+\r