1 Return-Path: <markwalters1009@gmail.com>
\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 A3E8A429E34
\r
6 for <notmuch@notmuchmail.org>; Thu, 15 Mar 2012 11:42:26 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0.201 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,
\r
14 RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
15 Received: from olra.theworths.org ([127.0.0.1])
\r
16 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
17 with ESMTP id E1FjWsKDpaKS for <notmuch@notmuchmail.org>;
\r
18 Thu, 15 Mar 2012 11:42:24 -0700 (PDT)
\r
19 Received: from mail-wi0-f179.google.com (mail-wi0-f179.google.com
\r
20 [209.85.212.179]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
21 (No client certificate requested)
\r
22 by olra.theworths.org (Postfix) with ESMTPS id 1A108431FAE
\r
23 for <notmuch@notmuchmail.org>; Thu, 15 Mar 2012 11:42:23 -0700 (PDT)
\r
24 Received: by mail-wi0-f179.google.com with SMTP id hn6so3844513wib.2
\r
25 for <notmuch@notmuchmail.org>; Thu, 15 Mar 2012 11:42:23 -0700 (PDT)
\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
\r
27 h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
\r
28 bh=X7tkFsQY8U9jLo4+S2QF/rBwSLaAQ6WxxiIl/BwhV8Q=;
\r
29 b=VvrGEM7WP4kqop5FZAUbKTHzPGlqLG475xTD/D1Ct7STONPQ4ZVTzXMPI9bJ6Hua9C
\r
30 6PWFjpiwTLC52cc5Wz7tcgCwNnN8117D+KwGWyh+sYz7nW2tImimwl7HHWtMvW+41U7X
\r
31 AtEGgDVoeb3hBdcBj92FVRKcx5nssMR/Cgb6dVuxGiaEAx9SawIPXoafT8Pxh1HqANJN
\r
32 tKK+7fDdmNw0ag8d1w+HT7U7LCU8ahMApql99zkSuKdQrwtK/VS3Sc116F6AtZLlrNM1
\r
33 NaR0icdEqdMk2kQ08vWeptvv5OCmxN4aSXWXNO9Mi5blIY2JG8jIIBBGItdi79dsoDJE
\r
35 Received: by 10.180.95.129 with SMTP id dk1mr1649820wib.3.1331836943775;
\r
36 Thu, 15 Mar 2012 11:42:23 -0700 (PDT)
\r
37 Received: from localhost (94-192-233-223.zone6.bethere.co.uk.
\r
38 [94.192.233.223]) by mx.google.com with ESMTPS id
\r
39 df3sm7082139wib.1.2012.03.15.11.42.22 (version=TLSv1/SSLv3 cipher=OTHER);
\r
40 Thu, 15 Mar 2012 11:42:23 -0700 (PDT)
\r
41 From: Mark Walters <markwalters1009@gmail.com>
\r
42 To: notmuch@notmuchmail.org
\r
43 Subject: [PATCH 4/5] cli: move show to the new --exclude= option naming
\r
45 Date: Thu, 15 Mar 2012 18:42:04 +0000
\r
46 Message-Id: <1331836925-31437-5-git-send-email-markwalters1009@gmail.com>
\r
47 X-Mailer: git-send-email 1.7.9.1
\r
48 In-Reply-To: <1331836925-31437-1-git-send-email-markwalters1009@gmail.com>
\r
49 References: <1331836925-31437-1-git-send-email-markwalters1009@gmail.com>
\r
50 X-BeenThere: notmuch@notmuchmail.org
\r
51 X-Mailman-Version: 2.1.13
\r
53 List-Id: "Use and development of the notmuch mail system."
\r
54 <notmuch.notmuchmail.org>
\r
55 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
56 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
57 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
58 List-Post: <mailto:notmuch@notmuchmail.org>
\r
59 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
60 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
61 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
62 X-List-Received-Date: Thu, 15 Mar 2012 18:42:27 -0000
\r
64 This moves show to the --exclude=(true|false|flag) naming
\r
65 scheme. When `exclude' is false or flag show returns all threads
\r
66 that match including those that only match in an excluded message, the
\r
67 difference being whether excluded messages are flagged excluded.
\r
69 When exclude=true the behaviour depends on whether --entire-threads
\r
70 is set. If it is not set then show only returns the messages which
\r
71 match and are not excluded. If it is set then show returns all
\r
72 messages in these threads flagging the excluded messages. The
\r
73 rationale is that it is awkward to use a thread with some missing
\r
76 man/man1/notmuch-show.1 | 16 ++++++++++++++--
\r
77 notmuch-client.h | 1 +
\r
78 notmuch-show.c | 39 +++++++++++++++++++++++++++++----------
\r
79 3 files changed, 44 insertions(+), 12 deletions(-)
\r
81 diff --git a/man/man1/notmuch-show.1 b/man/man1/notmuch-show.1
\r
82 index d75d971..801b7f1 100644
\r
83 --- a/man/man1/notmuch-show.1
\r
84 +++ b/man/man1/notmuch-show.1
\r
85 @@ -130,9 +130,21 @@ content.
\r
90 +.BR \-\-exclude=(true|false|flag)
\r
92 +Specify whether to omit threads only matching search.tag_exclude from
\r
93 +the search results (the default) or not. The extra option
\r
95 +includes these messages but marks them with the excluded flag.
\r
97 +If --entire-thread is specified then complete threads are returned
\r
98 +regardless (with the excluded flag being set when appropriate) but
\r
99 +threads that only match in an excluded message are not returned when
\r
100 +.B --exclude=true.
\r
103 +.B --exclude=true.
\r
105 -Do not exclude the messages matching search.exclude_tags in the config file.
\r
109 diff --git a/notmuch-client.h b/notmuch-client.h
\r
110 index f4a62cc..e36148b 100644
\r
111 --- a/notmuch-client.h
\r
112 +++ b/notmuch-client.h
\r
113 @@ -99,6 +99,7 @@ typedef struct notmuch_show_format {
\r
115 typedef struct notmuch_show_params {
\r
116 notmuch_bool_t entire_thread;
\r
117 + notmuch_bool_t omit_excluded;
\r
118 notmuch_bool_t raw;
\r
120 #ifdef GMIME_ATLEAST_26
\r
121 diff --git a/notmuch-show.c b/notmuch-show.c
\r
122 index 05d51b2..20d6635 100644
\r
123 --- a/notmuch-show.c
\r
124 +++ b/notmuch-show.c
\r
125 @@ -812,6 +812,7 @@ show_messages (void *ctx,
\r
127 notmuch_message_t *message;
\r
128 notmuch_bool_t match;
\r
129 + notmuch_bool_t excluded;
\r
133 @@ -830,10 +831,11 @@ show_messages (void *ctx,
\r
134 message = notmuch_messages_get (messages);
\r
136 match = notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH);
\r
137 + excluded = notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED);
\r
139 next_indent = indent;
\r
141 - if (match || params->entire_thread) {
\r
142 + if ((match && (!excluded || !params->omit_excluded)) || params->entire_thread) {
\r
143 show_message (ctx, format, message, indent, params);
\r
144 next_indent = indent + 1;
\r
146 @@ -974,6 +976,12 @@ enum {
\r
157 notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
\r
159 @@ -983,10 +991,10 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
\r
160 char *query_string;
\r
161 int opt_index, ret;
\r
162 const notmuch_show_format_t *format = &format_text;
\r
163 - notmuch_show_params_t params = { .part = -1 };
\r
164 + notmuch_show_params_t params = { .part = -1, .omit_excluded = TRUE };
\r
165 int format_sel = NOTMUCH_FORMAT_NOT_SPECIFIED;
\r
166 notmuch_bool_t verify = FALSE;
\r
167 - notmuch_bool_t no_exclude = FALSE;
\r
168 + int exclude = EXCLUDE_TRUE;
\r
170 notmuch_opt_desc_t options[] = {
\r
171 { NOTMUCH_OPT_KEYWORD, &format_sel, "format", 'f',
\r
172 @@ -995,11 +1003,15 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
\r
173 { "mbox", NOTMUCH_FORMAT_MBOX },
\r
174 { "raw", NOTMUCH_FORMAT_RAW },
\r
176 + { NOTMUCH_OPT_KEYWORD, &exclude, "exclude", 'x',
\r
177 + (notmuch_keyword_t []){ { "true", EXCLUDE_TRUE },
\r
178 + { "false", EXCLUDE_FALSE },
\r
179 + { "flag", EXCLUDE_FLAG },
\r
181 { NOTMUCH_OPT_INT, ¶ms.part, "part", 'p', 0 },
\r
182 { NOTMUCH_OPT_BOOLEAN, ¶ms.entire_thread, "entire-thread", 't', 0 },
\r
183 { NOTMUCH_OPT_BOOLEAN, ¶ms.decrypt, "decrypt", 'd', 0 },
\r
184 { NOTMUCH_OPT_BOOLEAN, &verify, "verify", 'v', 0 },
\r
185 - { NOTMUCH_OPT_BOOLEAN, &no_exclude, "no-exclude", 'n', 0 },
\r
189 @@ -1088,16 +1100,18 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
\r
193 - /* if format=mbox then we can not output excluded messages as
\r
194 - * there is no way to make the exclude flag available */
\r
195 - if (format_sel == NOTMUCH_FORMAT_MBOX)
\r
196 - notmuch_query_set_omit_excluded_messages (query, TRUE);
\r
198 /* If a single message is requested we do not use search_excludes. */
\r
199 if (params.part >= 0)
\r
200 ret = do_show_single (ctx, query, format, ¶ms);
\r
202 - if (!no_exclude) {
\r
203 + if (format == &format_mbox && exclude == EXCLUDE_FLAG) {
\r
204 + /* there is no where to mark flagged messages so fall back on
\r
205 + * including the excluded messages */
\r
206 + fprintf (stderr, "Cannot flag excluded messages with format=mbox: fall back on just including them\n");
\r
207 + exclude = EXCLUDE_FALSE;
\r
210 + if (exclude != EXCLUDE_FALSE) {
\r
211 const char **search_exclude_tags;
\r
212 size_t search_exclude_tags_length;
\r
214 @@ -1106,7 +1120,12 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
\r
215 (config, &search_exclude_tags_length);
\r
216 for (i = 0; i < search_exclude_tags_length; i++)
\r
217 notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);
\r
218 + if (exclude == EXCLUDE_FLAG) {
\r
219 + notmuch_query_set_omit_excluded_messages(query, FALSE);
\r
220 + params.omit_excluded = FALSE;
\r
224 ret = do_show (ctx, query, format, ¶ms);
\r