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 D78EA421174
\r
6 for <notmuch@notmuchmail.org>; Sun, 12 Feb 2012 17:19:22 -0800 (PST)
\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 nYMRwCAY+fSo for <notmuch@notmuchmail.org>;
\r
18 Sun, 12 Feb 2012 17:19:20 -0800 (PST)
\r
19 Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com
\r
20 [209.85.212.181]) (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 8AFF442117B
\r
23 for <notmuch@notmuchmail.org>; Sun, 12 Feb 2012 17:19:17 -0800 (PST)
\r
24 Received: by mail-wi0-f181.google.com with SMTP id hi8so3615406wib.26
\r
25 for <notmuch@notmuchmail.org>; Sun, 12 Feb 2012 17:19:17 -0800 (PST)
\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
\r
27 h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
\r
28 bh=HqIfNrUBY9HvmgZu0a+lYX/9AKyAG6MVNdwQdgCOG2w=;
\r
29 b=ZVdS31dPC/rZxihLvBXHKoO2r2KL0RDlE0pwZzBll6K+OAPllKR7qQGWxT5QnE3zMZ
\r
30 PThzjO1R5SoP2upRgvD2Ww7WNs7jJqh5e0fjwj0plI+zrc4Z27W+pz3iAsipazhqzlnX
\r
31 EZoNX9d3QT5h+UUeEf5Qg8/iM2arkfkHBsIPA=
\r
32 Received: by 10.216.132.94 with SMTP id n72mr5485613wei.4.1329095957266;
\r
33 Sun, 12 Feb 2012 17:19:17 -0800 (PST)
\r
34 Received: from localhost (94-192-233-223.zone6.bethere.co.uk.
\r
35 [94.192.233.223]) by mx.google.com with ESMTPS id
\r
36 dr5sm41857437wib.0.2012.02.12.17.19.15 (version=TLSv1/SSLv3 cipher=OTHER);
\r
37 Sun, 12 Feb 2012 17:19:16 -0800 (PST)
\r
38 From: Mark Walters <markwalters1009@gmail.com>
\r
39 To: notmuch@notmuchmail.org
\r
40 Subject: [RFC PATCH v3 03/11] cli: add --thread= option to notmuch-show
\r
41 Date: Mon, 13 Feb 2012 01:20:07 +0000
\r
42 Message-Id: <1329096015-8078-4-git-send-email-markwalters1009@gmail.com>
\r
43 X-Mailer: git-send-email 1.7.2.3
\r
44 In-Reply-To: <1329072579-27340-1-git-send-email-markwalters1009@gmail.com>
\r
45 References: <1329072579-27340-1-git-send-email-markwalters1009@gmail.com>
\r
46 X-BeenThere: notmuch@notmuchmail.org
\r
47 X-Mailman-Version: 2.1.13
\r
49 List-Id: "Use and development of the notmuch mail system."
\r
50 <notmuch.notmuchmail.org>
\r
51 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
52 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
53 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
54 List-Post: <mailto:notmuch@notmuchmail.org>
\r
55 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
56 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
57 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
58 X-List-Received-Date: Mon, 13 Feb 2012 01:19:23 -0000
\r
60 The possible values are --thread=none|entire|match.
\r
62 `entire' is exactly the existing option --entire-thread.
\r
64 `match' is exactly the existing case when --entire-thread is not specified.
\r
66 `none' is a new option to return just the matching messages with no
\r
67 threading information at all.
\r
69 The `none' option is used by notmuch-pick.el to display an unthreaded
\r
70 message view (e.g., for an inbox). It is also useful for displaying a
\r
71 single message in the notmuch-pick view as show/emacs is much faster at
\r
72 showing a single message than the whole thread.
\r
74 The default remains as before: `match' in all cases except when
\r
75 --format=json is specified when `entire' is used.
\r
77 notmuch-client.h | 8 ++++++-
\r
78 notmuch-show.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++--
\r
79 2 files changed, 64 insertions(+), 4 deletions(-)
\r
81 diff --git a/notmuch-client.h b/notmuch-client.h
\r
82 index 0da2d8d..b4dc7bf 100644
\r
83 --- a/notmuch-client.h
\r
84 +++ b/notmuch-client.h
\r
85 @@ -97,8 +97,14 @@ typedef struct notmuch_show_format {
\r
86 const char *message_set_end;
\r
87 } notmuch_show_format_t;
\r
90 + NOTMUCH_SHOW_THREAD_MATCH,
\r
91 + NOTMUCH_SHOW_THREAD_ENTIRE,
\r
92 + NOTMUCH_SHOW_THREAD_NONE
\r
95 typedef struct notmuch_show_params {
\r
96 - notmuch_bool_t entire_thread;
\r
97 + int entire_thread;
\r
101 diff --git a/notmuch-show.c b/notmuch-show.c
\r
102 index 8f6e520..3f8618b 100644
\r
103 --- a/notmuch-show.c
\r
104 +++ b/notmuch-show.c
\r
105 @@ -893,13 +893,56 @@ show_messages (void *ctx,
\r
106 notmuch_message_get_replies (message),
\r
109 + notmuch_message_destroy (message);
\r
111 + fputs (format->message_set_end, stdout);
\r
114 + fputs (format->message_set_end, stdout);
\r
118 +do_show_messages (void *ctx,
\r
119 + notmuch_query_t *query,
\r
120 + const notmuch_show_format_t *format,
\r
121 + notmuch_show_params_t *params)
\r
123 + notmuch_messages_t *messages;
\r
124 + notmuch_message_t *message;
\r
125 + int first_set = 1;
\r
127 + fputs (format->message_set_start, stdout);
\r
128 + messages = notmuch_query_search_messages (query);
\r
131 + notmuch_messages_valid (messages);
\r
132 + notmuch_messages_move_to_next (messages))
\r
135 + fputs (format->message_set_sep, stdout);
\r
138 + fputs (format->message_set_start, stdout);
\r
139 + fputs (format->message_set_start, stdout);
\r
141 + message = notmuch_messages_get (messages);
\r
142 + notmuch_message_set_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH, 1);
\r
143 + show_message (ctx, format, message, 0, params);
\r
145 + fputs (format->message_set_sep, stdout);
\r
147 + fputs (format->message_set_start, stdout);
\r
148 + fputs (format->message_set_end, stdout);
\r
151 notmuch_message_destroy (message);
\r
153 fputs (format->message_set_end, stdout);
\r
154 + fputs (format->message_set_end, stdout);
\r
157 fputs (format->message_set_end, stdout);
\r
161 /* Formatted output of single message */
\r
162 @@ -1030,6 +1073,7 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
\r
163 notmuch_query_t *query;
\r
164 char *query_string;
\r
165 int opt_index, ret;
\r
166 + int entire_thread = NOTMUCH_SHOW_THREAD_MATCH;
\r
167 notmuch_sort_t sort = NOTMUCH_SORT_NEWEST_FIRST;
\r
168 const notmuch_show_format_t *format = &format_text;
\r
169 notmuch_show_params_t params = { .part = -1 };
\r
170 @@ -1049,7 +1093,11 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
\r
171 { "newest-first", NOTMUCH_SORT_NEWEST_FIRST },
\r
173 { NOTMUCH_OPT_INT, ¶ms.part, "part", 'p', 0 },
\r
174 - { NOTMUCH_OPT_BOOLEAN, ¶ms.entire_thread, "entire-thread", 't', 0 },
\r
175 + { NOTMUCH_OPT_KEYWORD, &entire_thread, "thread", 't',
\r
176 + (notmuch_keyword_t []){ { "match", NOTMUCH_SHOW_THREAD_MATCH, },
\r
177 + { "entire", NOTMUCH_SHOW_THREAD_ENTIRE },
\r
178 + { "none", NOTMUCH_SHOW_THREAD_NONE },
\r
180 { NOTMUCH_OPT_BOOLEAN, ¶ms.decrypt, "decrypt", 'd', 0 },
\r
181 { NOTMUCH_OPT_BOOLEAN, &verify, "verify", 'v', 0 },
\r
182 { NOTMUCH_OPT_BOOLEAN, &headers_only, "headers-only", 'h', 0 },
\r
183 @@ -1062,6 +1110,7 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
\r
187 + params.entire_thread = entire_thread;
\r
188 params.headers_only = headers_only;
\r
190 if (format_sel == NOTMUCH_FORMAT_NOT_SPECIFIED) {
\r
191 @@ -1075,7 +1124,9 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
\r
192 switch (format_sel) {
\r
193 case NOTMUCH_FORMAT_JSON:
\r
194 format = &format_json;
\r
195 - params.entire_thread = TRUE;
\r
196 + /* This may not still be wanted */
\r
197 + if (params.entire_thread == NOTMUCH_SHOW_THREAD_MATCH)
\r
198 + params.entire_thread = NOTMUCH_SHOW_THREAD_ENTIRE;
\r
200 case NOTMUCH_FORMAT_TEXT:
\r
201 format = &format_text;
\r
202 @@ -1147,7 +1198,10 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
\r
203 if (params.part >= 0)
\r
204 ret = do_show_single (ctx, query, format, ¶ms);
\r
206 - ret = do_show (ctx, query, format, ¶ms);
\r
207 + if (params.entire_thread == NOTMUCH_SHOW_THREAD_NONE)
\r
208 + ret = do_show_messages (ctx, query, format, ¶ms);
\r
210 + ret = do_show (ctx, query, format, ¶ms);
\r
212 notmuch_query_destroy (query);
\r
213 notmuch_database_close (notmuch);
\r