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