1 Return-Path: <sojka@merica.cz>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 16903431FAE
\r
6 for <notmuch@notmuchmail.org>; Tue, 4 Nov 2014 12:15:38 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-1.224 tagged_above=-999 required=5
\r
12 tests=[DATE_IN_PAST_03_06=1.076, RCVD_IN_DNSWL_MED=-2.3]
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id pV09gCfaBywZ for <notmuch@notmuchmail.org>;
\r
17 Tue, 4 Nov 2014 12:15:30 -0800 (PST)
\r
18 X-Greylist: delayed 300 seconds by postgrey-1.32 at olra;
\r
19 Tue, 04 Nov 2014 12:15:29 PST
\r
20 Received: from relay.felk.cvut.cz (relay.felk.cvut.cz [147.32.80.7])
\r
21 by olra.theworths.org (Postfix) with ESMTP id CB225431FB6
\r
22 for <notmuch@notmuchmail.org>; Tue, 4 Nov 2014 12:15:29 -0800 (PST)
\r
23 Received: from control.felk.cvut.cz (control.felk.cvut.cz [147.32.87.4])
\r
24 by relay.felk.cvut.cz (8.14.9/8.14.9) with ESMTP id sA4FZxMn036846;
\r
25 Tue, 4 Nov 2014 16:36:00 +0100 (CET) (envelope-from sojka@merica.cz)
\r
26 Received: from CONTROL/SpoolDir by control.felk.cvut.cz (Mercury 1.48);
\r
27 4 Nov 14 16:36:01 +0100
\r
28 Received: from SpoolDir by CONTROL (Mercury 1.48); 4 Nov 14 16:35:54 +0100
\r
29 Received: from rtime.felk.cvut.cz (147.32.86.92) by control.felk.cvut.cz
\r
30 (Mercury 1.48) with ESMTP; 4 Nov 14 16:35:53 +0100
\r
31 Received: from localhost ([127.0.0.1] helo=steelpick.2x.cz)
\r
32 by rtime.felk.cvut.cz with esmtp (Exim 4.80)
\r
33 (envelope-from <sojka@merica.cz>)
\r
34 id 1Xlg9A-0004xd-Vm; Tue, 04 Nov 2014 16:35:53 +0100
\r
35 Received: from wsh by steelpick.2x.cz with local (Exim 4.84)
\r
36 (envelope-from <sojka@merica.cz>)
\r
37 id 1XlcFO-0002OM-St; Tue, 04 Nov 2014 12:26:02 +0100
\r
38 From: Michal Sojka <sojkam1@fel.cvut.cz>
\r
39 To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org
\r
40 Subject: Re: [PATCH v2 07/10] cli: search: Convert --output to keyword
\r
42 In-Reply-To: <87389z4a1g.fsf@qmul.ac.uk>
\r
43 References: <1415058622-21162-1-git-send-email-sojkam1@fel.cvut.cz>
\r
44 <1415058622-21162-8-git-send-email-sojkam1@fel.cvut.cz>
\r
45 <87389z4a1g.fsf@qmul.ac.uk>
\r
46 User-Agent: Notmuch/0.18.2+157~ga00d359 (http://notmuchmail.org) Emacs/24.3.1
\r
47 (x86_64-pc-linux-gnu)
\r
48 Date: Tue, 04 Nov 2014 12:26:02 +0100
\r
49 Message-ID: <87d293mcl1.fsf@steelpick.2x.cz>
\r
51 Content-Type: text/plain
\r
52 X-FELK-MailScanner-Information:
\r
53 X-MailScanner-ID: sA4FZxMn036846
\r
54 X-FELK-MailScanner: Found to be clean
\r
55 X-FELK-MailScanner-SpamCheck: not spam, SpamAssassin (not cached,
\r
56 score=1.093, required 6, BAYES_00 -0.50, DATE_IN_PAST_03_06 1.59,
\r
57 HEADER_FROM_DIFFERENT_DOMAINS 0.00)
\r
58 X-FELK-MailScanner-SpamScore: s
\r
59 X-FELK-MailScanner-From: sojka@merica.cz
\r
60 X-FELK-MailScanner-Watermark: 1415720167.13071@8ULxbe+NOiHFa8Z1Yt4Azg
\r
61 X-BeenThere: notmuch@notmuchmail.org
\r
62 X-Mailman-Version: 2.1.13
\r
64 List-Id: "Use and development of the notmuch mail system."
\r
65 <notmuch.notmuchmail.org>
\r
66 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
67 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
68 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
69 List-Post: <mailto:notmuch@notmuchmail.org>
\r
70 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
71 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
72 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
73 X-List-Received-Date: Tue, 04 Nov 2014 20:15:38 -0000
\r
75 On Tue, Nov 04 2014, Mark Walters wrote:
\r
78 > On Mon, 03 Nov 2014, Michal Sojka <sojkam1@fel.cvut.cz> wrote:
\r
79 >> Now, when address related outputs are in a separate command, it makes
\r
80 >> no sense to combine multiple --output options in search command line.
\r
81 >> Using switch statement to handle different outputs is more readable
\r
82 >> than a series of if statements.
\r
84 > I am not keen on this change: I think the user should always be able to
\r
85 > force the default output by setting command line options (which should
\r
86 > protect against future changes in the default).
\r
88 You can do this even with this patch.
\r
90 > Thus I would like to continue to allow --output=sender
\r
91 > --output=recipients.
\r
93 This is allowed in notmuch address. This patch modifies only notmuch
\r
94 search. Currently it makes no sense to run --output=files --output=tags
\r
95 or other output combinations.
\r
97 > I do approve of making the default do something useful but whether it
\r
98 > should be both or just sender (which is much faster) is unclear to me.
\r
100 Does this comment refer to 7/10 or to 6/10?
\r
102 I'd say it refers to the following line from 6/10.
\r
104 search_context.output = OUTPUT_SENDER | OUTPUT_RECIPIENTS;
\r
106 Even there you can override the default by command line option. This get
\r
107 executed only if no --output appears on the command line.
\r
120 >> doc/man1/notmuch-search.rst | 3 ---
\r
121 >> notmuch-search.c | 25 +++++++++++++------------
\r
122 >> 2 files changed, 13 insertions(+), 15 deletions(-)
\r
124 >> diff --git a/doc/man1/notmuch-search.rst b/doc/man1/notmuch-search.rst
\r
125 >> index 65df288..0cc2911 100644
\r
126 >> --- a/doc/man1/notmuch-search.rst
\r
127 >> +++ b/doc/man1/notmuch-search.rst
\r
128 >> @@ -78,9 +78,6 @@ Supported options for **search** include
\r
129 >> by null characters (--format=text0), as a JSON array
\r
130 >> (--format=json), or as an S-Expression list (--format=sexp).
\r
132 >> - This option can be given multiple times to combine different
\r
135 >> ``--sort=``\ (**newest-first**\ \|\ **oldest-first**)
\r
136 >> This option can be used to present results in either
\r
137 >> chronological order (**oldest-first**) or reverse chronological
\r
138 >> diff --git a/notmuch-search.c b/notmuch-search.c
\r
139 >> index cbd84f5..402e860 100644
\r
140 >> --- a/notmuch-search.c
\r
141 >> +++ b/notmuch-search.c
\r
142 >> @@ -593,7 +593,7 @@ notmuch_search_command (notmuch_config_t *config, int argc, char *argv[])
\r
143 >> int opt_index, ret;
\r
145 >> notmuch_opt_desc_t options[] = {
\r
146 >> - { NOTMUCH_OPT_KEYWORD_FLAGS, &ctx->output, "output", 'o',
\r
147 >> + { NOTMUCH_OPT_KEYWORD, &ctx->output, "output", 'o',
\r
148 >> (notmuch_keyword_t []){ { "summary", OUTPUT_SUMMARY },
\r
149 >> { "threads", OUTPUT_THREADS },
\r
150 >> { "messages", OUTPUT_MESSAGES },
\r
151 >> @@ -607,13 +607,11 @@ notmuch_search_command (notmuch_config_t *config, int argc, char *argv[])
\r
152 >> { 0, 0, 0, 0, 0 }
\r
155 >> + ctx->output = OUTPUT_SUMMARY;
\r
156 >> opt_index = parse_arguments (argc, argv, options, 1);
\r
157 >> if (opt_index < 0)
\r
158 >> return EXIT_FAILURE;
\r
160 >> - if (! ctx->output)
\r
161 >> - ctx->output = OUTPUT_SUMMARY;
\r
163 >> if (ctx->output != OUTPUT_FILES && ctx->output != OUTPUT_MESSAGES &&
\r
164 >> ctx->dupe != -1) {
\r
165 >> fprintf (stderr, "Error: --duplicate=N is only supported with --output=files and --output=messages.\n");
\r
166 >> @@ -624,17 +622,20 @@ notmuch_search_command (notmuch_config_t *config, int argc, char *argv[])
\r
167 >> argc - opt_index, argv + opt_index))
\r
168 >> return EXIT_FAILURE;
\r
170 >> - if (ctx->output == OUTPUT_SUMMARY ||
\r
171 >> - ctx->output == OUTPUT_THREADS)
\r
172 >> + switch (ctx->output) {
\r
173 >> + case OUTPUT_SUMMARY:
\r
174 >> + case OUTPUT_THREADS:
\r
175 >> ret = do_search_threads (ctx);
\r
176 >> - else if (ctx->output == OUTPUT_MESSAGES ||
\r
177 >> - ctx->output == OUTPUT_FILES)
\r
179 >> + case OUTPUT_MESSAGES:
\r
180 >> + case OUTPUT_FILES:
\r
181 >> ret = do_search_messages (ctx);
\r
182 >> - else if (ctx->output == OUTPUT_TAGS)
\r
184 >> + case OUTPUT_TAGS:
\r
185 >> ret = do_search_tags (ctx);
\r
187 >> - fprintf (stderr, "Error: the combination of outputs is not supported.\n");
\r
191 >> + INTERNAL_ERROR ("Unexpected output");
\r
194 >> _notmuch_search_cleanup (ctx);
\r
198 >> _______________________________________________
\r
199 >> notmuch mailing list
\r
200 >> notmuch@notmuchmail.org
\r
201 >> http://notmuchmail.org/mailman/listinfo/notmuch
\r