Re: [PATCH 1/7] cli: add --do-not-exclude option to count and search.
authorAustin Clements <amdragon@MIT.EDU>
Tue, 31 Jan 2012 04:17:32 +0000 (23:17 +1900)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:43:45 +0000 (09:43 -0800)
ac/02c73d49a374472ee37cfe70d62d5a1b4b8b43 [new file with mode: 0644]

diff --git a/ac/02c73d49a374472ee37cfe70d62d5a1b4b8b43 b/ac/02c73d49a374472ee37cfe70d62d5a1b4b8b43
new file mode 100644 (file)
index 0000000..b2d504e
--- /dev/null
@@ -0,0 +1,172 @@
+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 71332431E64\r
+       for <notmuch@notmuchmail.org>; Mon, 30 Jan 2012 20:18:27 -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 akhuy1ezm+56 for <notmuch@notmuchmail.org>;\r
+       Mon, 30 Jan 2012 20:18:26 -0800 (PST)\r
+Received: from dmz-mailsec-scanner-5.mit.edu (DMZ-MAILSEC-SCANNER-5.MIT.EDU\r
+       [18.7.68.34])\r
+       by olra.theworths.org (Postfix) with ESMTP id B407B431FBC\r
+       for <notmuch@notmuchmail.org>; Mon, 30 Jan 2012 20:18:26 -0800 (PST)\r
+X-AuditID: 12074422-b7fd66d0000008f9-ae-4f276b92e084\r
+Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
+       by dmz-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id B1.F4.02297.29B672F4; Mon, 30 Jan 2012 23:18:26 -0500 (EST)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+       by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id q0V4IPxl030295; \r
+       Mon, 30 Jan 2012 23:18:26 -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 q0V4INfx025696\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Mon, 30 Jan 2012 23:18:24 -0500 (EST)\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1Rs59w-0002ks-7a; Mon, 30 Jan 2012 23:17:32 -0500\r
+Date: Mon, 30 Jan 2012 23:17:32 -0500\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: Mark Walters <markwalters1009@gmail.com>\r
+Subject: Re: [PATCH 1/7] cli: add --do-not-exclude option to count and search.\r
+Message-ID: <20120131041732.GY17991@mit.edu>\r
+References: <8762fu4aqt.fsf@qmul.ac.uk>\r
+       <1327862394-14334-1-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-1-git-send-email-markwalters1009@gmail.com>\r
+User-Agent: Mutt/1.5.21 (2010-09-15)\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFmpmleLIzCtJLcpLzFFi42IRYrdT152Ure5vMHEZv8XquTwW12/OZHZg\r
+       8tg56y67x7NVt5gDmKK4bFJSczLLUov07RK4MtbNPsdacFSm4uSKR2wNjAvEuhg5OSQETCT+\r
+       3+png7DFJC7cWw9kc3EICexjlHh1ZAMLhLOBUeLX6wtMEM5JJokpW+exQzhLGCVaJ69mB+ln\r
+       EVCVmHb6AwuIzSagIbFt/3JGEFtEQEfi9qEFYDXMAtIS3343M4HYwgJ+Ep+fT2AGsXmBag6v\r
+       ngtWIySQLtHVPYkNIi4ocXLmExaIXi2JG/9eAvVygM1Z/o8DJMwp4CVxa+4ZsFWiAioSU05u\r
+       Y5vAKDQLSfcsJN2zELoXMDKvYpRNya3SzU3MzClOTdYtTk7My0st0jXVy80s0UtNKd3ECA5r\r
+       F6UdjD8PKh1iFOBgVOLh3fNezV+INbGsuDL3EKMkB5OSKG9Pprq/EF9SfkplRmJxRnxRaU5q\r
+       8SFGCQ5mJRHeN6uBynlTEiurUovyYVLSHCxK4rzqWu/8gP5NLEnNTk0tSC2CycpwcChJ8DIA\r
+       41dIsCg1PbUiLTOnBCHNxMEJMpwHaLg5SA1vcUFibnFmOkT+FKOilDivIEhCACSRUZoH1wtL\r
+       O68YxYFeEeYVBaniAaYsuO5XQIOZgAY/Z1AFGVySiJCSamCUUto35YXQt74LOZ7HeiRUp+Q1\r
+       /dGZ8uCA8fQD75l5lvfs7+Lf9+uTBFdKUPL/G11/1JNzk4/pKOTfb++QfHAopl+vVaRgAnva\r
+       7/OLgrd6nZNgCON65m7ysX+rP/vEr5GW7za/mhxyK/3hSvUL4bW6OoxJp2aEe6Wvn6fQP/9q\r
+       PE91TcrnioVKLMUZiYZazEXFiQD5axLcFgMAAA==\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:18:27 -0000\r
+\r
+Quoth Mark Walters on Jan 29 at  6:39 pm:\r
+> This option turns off the exclusion so all matching messages are\r
+> returned. We do not need to add this to show as notmuch-show does not\r
+> (yet) exclude.\r
+> ---\r
+>  notmuch-count.c  |   12 ++++++++----\r
+>  notmuch-search.c |   12 ++++++++----\r
+>  2 files changed, 16 insertions(+), 8 deletions(-)\r
+> \r
+> diff --git a/notmuch-count.c b/notmuch-count.c\r
+> index 63459fb..c88975e 100644\r
+> --- a/notmuch-count.c\r
+> +++ b/notmuch-count.c\r
+> @@ -37,6 +37,7 @@ notmuch_count_command (void *ctx, int argc, char *argv[])\r
+>      int output = OUTPUT_MESSAGES;\r
+>      const char **search_exclude_tags;\r
+>      size_t search_exclude_tags_length;\r
+> +    notmuch_bool_t do_not_exclude = FALSE;\r
+>      unsigned int i;\r
+>  \r
+>      notmuch_opt_desc_t options[] = {\r
+> @@ -44,6 +45,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,  &do_not_exclude, "do-not-exclude", 'd', 0 },\r
+\r
+Maybe just "no-exclude"?  "do-not-exclude" seems needlessly verbose.\r
+\r
+Also, you have an extra space after the first comma.\r
+\r
+>      { 0, 0, 0, 0, 0 }\r
+>      };\r
+>  \r
+> @@ -78,10 +80,12 @@ 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 (!do_not_exclude) {\r
+\r
+You could move search_exclude_tags and search_exclude_tags_length in\r
+here now that it's a block (but you don't have to).\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 d504051..084dd05 100644\r
+> --- a/notmuch-search.c\r
+> +++ b/notmuch-search.c\r
+> @@ -425,6 +425,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[])\r
+>      int limit = -1; /* unlimited */\r
+>      const char **search_exclude_tags;\r
+>      size_t search_exclude_tags_length;\r
+> +    notmuch_bool_t do_not_exclude = FALSE;\r
+>      unsigned int i;\r
+>  \r
+>      enum { NOTMUCH_FORMAT_JSON, NOTMUCH_FORMAT_TEXT }\r
+> @@ -446,6 +447,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,  &do_not_exclude, "do-not-exclude", 'd', 0 },\r
+\r
+Same.\r
+\r
+>      { NOTMUCH_OPT_INT, &offset, "offset", 'O', 0 },\r
+>      { NOTMUCH_OPT_INT, &limit, "limit", 'L', 0  },\r
+>      { 0, 0, 0, 0, 0 }\r
+> @@ -493,10 +495,12 @@ 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 (!do_not_exclude) {\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