From: Austin Clements Date: Fri, 24 Feb 2012 23:03:39 +0000 (+1900) Subject: Re: [RFC PATCH v5 01/11] cli: add --no-exclude option to count and search. X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=4dbd9779957a3d8f8419852b58b5bd82f18a8e55;p=notmuch-archives.git Re: [RFC PATCH v5 01/11] cli: add --no-exclude option to count and search. --- diff --git a/04/6a1ad370388f9bbd26cdccf9c3356fce7d2c69 b/04/6a1ad370388f9bbd26cdccf9c3356fce7d2c69 new file mode 100644 index 000000000..78f551ca0 --- /dev/null +++ b/04/6a1ad370388f9bbd26cdccf9c3356fce7d2c69 @@ -0,0 +1,174 @@ +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 08F05416284 + for ; Fri, 24 Feb 2012 15:03:43 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[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 vJoUmxF9ZcLI for ; + Fri, 24 Feb 2012 15:03:42 -0800 (PST) +Received: from dmz-mailsec-scanner-2.mit.edu (DMZ-MAILSEC-SCANNER-2.MIT.EDU + [18.9.25.13]) + by olra.theworths.org (Postfix) with ESMTP id 4F0B2414786 + for ; Fri, 24 Feb 2012 15:03:42 -0800 (PST) +X-AuditID: 1209190d-b7fbf6d0000008ba-5c-4f48174dd49f +Received: from mailhub-auth-1.mit.edu ( [18.9.21.35]) + by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP + id 61.4B.02234.D47184F4; Fri, 24 Feb 2012 18:03:41 -0500 (EST) +Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) + by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id q1ON3fXv030165; + Fri, 24 Feb 2012 18:03:41 -0500 +Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) + (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q1ON3dqW020535 + (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); + Fri, 24 Feb 2012 18:03:40 -0500 (EST) +Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77) + (envelope-from ) + id 1S14At-0000dr-4E; Fri, 24 Feb 2012 18:03:39 -0500 +Date: Fri, 24 Feb 2012 18:03:39 -0500 +From: Austin Clements +To: Mark Walters +Subject: Re: [RFC PATCH v5 01/11] cli: add --no-exclude option to count and + search. +Message-ID: <20120224230339.GE30513@mit.edu> +References: <1329296619-7463-1-git-send-email-markwalters1009@gmail.com> + <1329296619-7463-2-git-send-email-markwalters1009@gmail.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <1329296619-7463-2-git-send-email-markwalters1009@gmail.com> +User-Agent: Mutt/1.5.21 (2010-09-15) +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFmpileLIzCtJLcpLzFFi42IR4hRV1vUV9/A32NluYrF6Lo/F9ZszmR2Y + PHbOusvu8WzVLeYApigum5TUnMyy1CJ9uwSujMPLlrEVfJCpePHwOmsD406xLkZODgkBE4m+ + J7dZIWwxiQv31rN1MXJxCAnsY5Q4M2UtK4SzgVFiwuZnLCBVQgInmSRO7s2HSCxhlJg18QF7 + FyMHB4uAqsTHBzIgNWwCGhLb9i9nBLFFBHQkbh9awA5iMwtIS3z73cwEYgsLhEo8mPYDLM4L + VLOnvZMZYmY7o8S26TNYIBKCEidnPmGBaNaSuPHvJRPILpBBy/9xgIQ5BTwlbrf/ANslKqAi + MeXkNrYJjEKzkHTPQtI9C6F7ASPzKkbZlNwq3dzEzJzi1GTd4uTEvLzUIl0jvdzMEr3UlNJN + jOCgluTdwfjuoNIhRgEORiUeXuYt7v5CrIllxZW5hxglOZiURHmXi3n4C/El5adUZiQWZ8QX + leakFh9ilOBgVhLhtWMDyvGmJFZWpRblw6SkOViUxHlVtd75CQmkJ5akZqemFqQWwWRlODiU + JHjXgwwVLEpNT61Iy8wpQUgzcXCCDOcBGn4WpIa3uCAxtzgzHSJ/ilFRSpy3HSQhAJLIKM2D + 64UlnVeM4kCvCPMuA6niASYsuO5XQIOZgAbb/3UFGVySiJCSamCccu+aYr6zonHoDc/bf5eu + iDboldu4fGrw1p77334xNgWrOgpWXE5YVp1csH5TB2NXzM+nrBK+p5NK13HqSURPKmU5oHF6 + 5fwfy/18hO3k9EJ+LT82sf1nRISr1c5PhnkZv20OsgWpXs5mTJCrXXj/M6eGvFZls9pc/smp + V4NyclN+bZnzyEyJpTgj0VCLuag4EQAne2QdFQMAAA== +Cc: notmuch@notmuchmail.org +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: Fri, 24 Feb 2012 23:03:43 -0000 + +Quoth Mark Walters on Feb 15 at 9:03 am: +> 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 d504051..43ec90b 100644 +> --- a/notmuch-search.c +> +++ b/notmuch-search.c +> @@ -423,8 +423,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 } +> @@ -446,6 +445,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 }, + +Indentation error. Otherwise this patch LGTM. + +> { NOTMUCH_OPT_INT, &offset, "offset", 'O', 0 }, +> { NOTMUCH_OPT_INT, &limit, "limit", 'L', 0 }, +> { 0, 0, 0, 0, 0 } +> @@ -493,10 +493,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: