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 1D48F429E34 for ; Tue, 31 Jan 2012 03:39:01 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.098 X-Spam-Level: X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5 tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] 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 0RnTGWMhjgf2 for ; Tue, 31 Jan 2012 03:39:00 -0800 (PST) Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 5A4C5431E64 for ; Tue, 31 Jan 2012 03:39:00 -0800 (PST) Received: from smtp.qmul.ac.uk ([138.37.6.40]) by mail2.qmul.ac.uk with esmtp (Exim 4.71) (envelope-from ) id 1RsC35-0002PT-BP; Tue, 31 Jan 2012 11:38:55 +0000 Received: from 94-192-233-223.zone6.bethere.co.uk ([94.192.233.223] helo=localhost) by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69) (envelope-from ) id 1RsC34-0006DK-QH; Tue, 31 Jan 2012 11:38:55 +0000 From: Mark Walters To: Austin Clements Subject: Re: [PATCH 1/7] cli: add --do-not-exclude option to count and search. In-Reply-To: <20120131041732.GY17991@mit.edu> References: <8762fu4aqt.fsf@qmul.ac.uk> <1327862394-14334-1-git-send-email-markwalters1009@gmail.com> <20120131041732.GY17991@mit.edu> User-Agent: Notmuch/0.11+137~g98adc3d (http://notmuchmail.org) Emacs/23.2.1 (i486-pc-linux-gnu) Date: Tue, 31 Jan 2012 11:40:00 +0000 Message-ID: <871uqgdrsf.fsf@qmul.ac.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Sender-Host-Address: 94.192.233.223 X-QM-SPAM-Info: Sender has good ham record. :) X-QM-Body-MD5: f70a79ed6187b09a558b60e6f55ed0b5 (of first 20000 bytes) X-SpamAssassin-Score: -1.8 X-SpamAssassin-SpamBar: - X-SpamAssassin-Report: The QM spam filters have analysed this message to determine if it is spam. We require at least 5.0 points to mark a message as spam. This message scored -1.8 points. Summary of the scoring: * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, * medium trust * [138.37.6.40 listed in list.dnswl.org] * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider * (markwalters1009[at]gmail.com) * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay * domain * 0.5 AWL AWL: From: address is in the auto white-list X-QM-Scan-Virus: ClamAV says the message is clean 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 11:39:01 -0000 Thanks for the review. Almost all of it (for all all the patches) I agree with and will just fix but I do have a couple of queries. On Mon, 30 Jan 2012 23:17:32 -0500, Austin Clements wrote: > 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. The reason I went for verbose do-not-exclude was to try and avoid the double negative ambiguity: does no-exclude mean do-not-exclude or do-note-return-excluded-messages. Possibly I am worrying needlessly, and obviously I am quite happy to change. > Also, you have an extra space after the first comma. Will fix. > > > { 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). Will fix > > + 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. Will fix > > > { 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: Thanks Mark