--- /dev/null
+Return-Path: <amdragon@mit.edu>\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 703E0418C2B\r
+ for <notmuch@notmuchmail.org>; Mon, 30 Jan 2012 20:57:37 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+ tests=[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 ne0xO-GaVN9o for <notmuch@notmuchmail.org>;\r
+ Mon, 30 Jan 2012 20:57:35 -0800 (PST)\r
+Received: from dmz-mailsec-scanner-7.mit.edu (DMZ-MAILSEC-SCANNER-7.MIT.EDU\r
+ [18.7.68.36])\r
+ by olra.theworths.org (Postfix) with ESMTP id E94CA414B92\r
+ for <notmuch@notmuchmail.org>; Mon, 30 Jan 2012 20:57:18 -0800 (PST)\r
+X-AuditID: 12074424-b7fae6d000000906-c8-4f2774ae5b89\r
+Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])\r
+ by dmz-mailsec-scanner-7.mit.edu (Symantec Messaging Gateway) with SMTP\r
+ id 0B.3A.02310.EA4772F4; Mon, 30 Jan 2012 23:57:18 -0500 (EST)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+ by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id q0V4vHXW004252; \r
+ Mon, 30 Jan 2012 23:57:18 -0500\r
+Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
+ (authenticated bits=0)\r
+ (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+ by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q0V4vGYZ002133\r
+ (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+ Mon, 30 Jan 2012 23:57:17 -0500 (EST)\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)\r
+ (envelope-from <amdragon@mit.edu>)\r
+ id 1Rs5lZ-0002nY-0A; Mon, 30 Jan 2012 23:56:25 -0500\r
+Date: Mon, 30 Jan 2012 23:56:24 -0500\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: Mark Walters <markwalters1009@gmail.com>\r
+Subject: Re: [PATCH 5/7] cli: Make notmuch-show respect excludes.\r
+Message-ID: <20120131045624.GB17991@mit.edu>\r
+References: <8762fu4aqt.fsf@qmul.ac.uk>\r
+ <1327862394-14334-5-git-send-email-markwalters1009@gmail.com>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+In-Reply-To: <1327862394-14334-5-git-send-email-markwalters1009@gmail.com>\r
+User-Agent: Mutt/1.5.21 (2010-09-15)\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFmpkleLIzCtJLcpLzFFi42IR4hTV1l1Xou5vcGi6osXquTwW12/OZHZg\r
+ 8tg56y67x7NVt5gDmKK4bFJSczLLUov07RK4Mqaf38RWMEOj4tamHywNjL/kuxg5OSQETCTm\r
+ P5/GDmGLSVy4t56ti5GLQ0hgH6NE286tzBDOBkaJPc9OQTknmSQa106AcpYwStxbPJ+li5GD\r
+ g0VAVeL+JUWQUWwCGhLb9i9nBLFFBHQkbh9aALaCWUBa4tvvZiYQW1jAUeJo02KwGl6gmhPn\r
+ v4CNERJIl5g3zwAiLChxcuYTFohWLYkb/14ygZSAjFn+jwMkzCngJXH86k5WEFtUQEViyslt\r
+ bBMYhWYh6Z6FpHsWQvcCRuZVjLIpuVW6uYmZOcWpybrFyYl5ealFuuZ6uZkleqkppZsYQSHN\r
+ 7qKyg7H5kNIhRgEORiUeXqFPav5CrIllxZW5hxglOZiURHnnFKj7C/El5adUZiQWZ8QXleak\r
+ Fh9ilOBgVhLhfbMaqJw3JbGyKrUoHyYlzcGiJM6rofXOD+jdxJLU7NTUgtQimKwMB4eSBO+b\r
+ YqChgkWp6akVaZk5JQhpJg5OkOE8QMPXgtTwFhck5hZnpkPkTzEqSonzHgNJCIAkMkrz4Hph\r
+ KecVozjQK8K8R0CqeIDpCq77FdBgJqDBzxlUQQaXJCKkpBoY2+/2fxF3WjnToP4h//9za/ov\r
+ zci6zDF34n6H3sCEYwvlt1e9yfYpVf07Q3zbOT3pzW4vDzwUtltkdOz+pAbXuCcdequ/J5W/\r
+ sJPcdOjinLUfprGk6VRxrLpkZrl5q9N3sa0tvXbb8+ZcWNir/359TYzDoS2fClbeXp10rEL6\r
+ wwkBvtNnpC6JViuxFGckGmoxFxUnAgDo5J8sFAMAAA==\r
+Cc: notmuch@notmuchmail.org\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: Tue, 31 Jan 2012 04:57:37 -0000\r
+\r
+Quoth Mark Walters on Jan 29 at 6:39 pm:\r
+> This adds the excludes to notmuch-show.c. We do not exclude when only\r
+> a single message (or part) is requested. notmuch-show will output the\r
+> exclude information when either text or json format is requested. As\r
+> this changes the output from notmuch-show it breaks many tests (in a\r
+> trivial and expected fashion).\r
+> ---\r
+> notmuch-show.c | 26 +++++++++++++++++++++-----\r
+> 1 files changed, 21 insertions(+), 5 deletions(-)\r
+> \r
+> diff --git a/notmuch-show.c b/notmuch-show.c\r
+> index dec799c..681827f 100644\r
+> --- a/notmuch-show.c\r
+> +++ b/notmuch-show.c\r
+> @@ -193,10 +193,12 @@ _get_one_line_summary (const void *ctx, notmuch_message_t *message)\r
+> static void\r
+> format_message_text (unused (const void *ctx), notmuch_message_t *message, int indent)\r
+> {\r
+> - printf ("id:%s depth:%d match:%d filename:%s\n",\r
+> + /* Could changing this could break users ? */\r
+\r
+I don't think anybody seriously tries to parse the text format, so I\r
+wouldn't worry about breaking anything.\r
+\r
+> + printf ("id:%s depth:%d match:%d excluded:%d filename:%s\n",\r
+> notmuch_message_get_message_id (message),\r
+> indent,\r
+> - notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH),\r
+> + notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH) ? 1 : 0,\r
+> + notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED) ? 1 : 0,\r
+> notmuch_message_get_filename (message));\r
+> }\r
+> \r
+> @@ -212,9 +214,10 @@ format_message_json (const void *ctx, notmuch_message_t *message, unused (int in\r
+> date = notmuch_message_get_date (message);\r
+> relative_date = notmuch_time_relative_date (ctx, date);\r
+> \r
+> - printf ("\"id\": %s, \"match\": %s, \"filename\": %s, \"timestamp\": %ld, \"date_relative\": \"%s\", \"tags\": [",\r
+> + printf ("\"id\": %s, \"match\": %s, \"excluded\": %s, \"filename\": %s, \"timestamp\": %ld, \"date_relative\": \"%s\", \"tags\": [",\r
+\r
+I wonder if it would be better to switch to an array of flag names...\r
+That obviously would break consumers, but it's worth thinking about in\r
+the longer term.\r
+\r
+> json_quote_str (ctx_quote, notmuch_message_get_message_id (message)),\r
+> notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH) ? "true" : "false",\r
+> + notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED) ? "true" : "false",\r
+> json_quote_str (ctx_quote, notmuch_message_get_filename (message)),\r
+> date, relative_date);\r
+> \r
+> @@ -1059,9 +1062,13 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
+> char *opt;\r
+> const notmuch_show_format_t *format = &format_text;\r
+> notmuch_show_params_t params;\r
+> + const char **search_exclude_tags;\r
+> + size_t search_exclude_tags_length;\r
+> int mbox = 0;\r
+> int format_specified = 0;\r
+> int i;\r
+> + notmuch_bool_t do_not_exclude = FALSE;\r
+> + unsigned int j;\r
+> \r
+> params.entire_thread = 0;\r
+> params.raw = 0;\r
+> @@ -1098,6 +1105,8 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
+> params.part = atoi(argv[i] + sizeof ("--part=") - 1);\r
+> } else if (STRNCMP_LITERAL (argv[i], "--entire-thread") == 0) {\r
+> params.entire_thread = 1;\r
+> + } else if (STRNCMP_LITERAL (argv[i], "--do-not-exclude") == 0) {\r
+> + do_not_exclude = TRUE;\r
+\r
+"no-exclude" if you change the others.\r
+\r
+> } else if ((STRNCMP_LITERAL (argv[i], "--verify") == 0) ||\r
+> (STRNCMP_LITERAL (argv[i], "--decrypt") == 0)) {\r
+> if (params.cryptoctx == NULL) {\r
+> @@ -1105,7 +1114,7 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
+> /* TODO: GMimePasswordRequestFunc */\r
+> if (NULL == (params.cryptoctx = g_mime_gpg_context_new(NULL, "gpg")))\r
+> #else\r
+> - GMimeSession* session = g_object_new(g_mime_session_get_type(), NULL);\r
+> + GMimeSession* session = g_object_new(g_mime_session_get_type(), NULL);\r
+\r
+Accidental reindent?\r
+\r
+> if (NULL == (params.cryptoctx = g_mime_gpg_context_new(session, "gpg")))\r
+> #endif\r
+> fprintf (stderr, "Failed to construct gpg context.\n");\r
+> @@ -1167,10 +1176,17 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
+> if (params.raw && params.part < 0)\r
+> params.part = 0;\r
+> \r
+> + /* if a single message is requested we do not use search_excludes */\r
+\r
+Capital and period.\r
+\r
+> if (params.part >= 0)\r
+> return do_show_single (ctx, query, format, ¶ms);\r
+> else\r
+> - return do_show (ctx, query, format, ¶ms);\r
+> + if (!do_not_exclude) {\r
+> + search_exclude_tags = notmuch_config_get_search_exclude_tags\r
+> + (config, &search_exclude_tags_length);\r
+> + for (j = 0; j < search_exclude_tags_length; j++)\r
+> + notmuch_query_add_tag_exclude (query, search_exclude_tags[j]);\r
+> + return do_show (ctx, query, format, ¶ms);\r
+> + }\r
+\r
+I don't think this is the control flow you meant. With\r
+--do-not-exclude, there won't be any output.\r
+\r
+> \r
+> notmuch_query_destroy (query);\r
+> notmuch_database_close (notmuch);\r
+\r
+Cool. That was easy!\r