1 Return-Path: <david@tethera.net>
\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 arlo.cworth.org (Postfix) with ESMTP id 93CB26DE0A9A
\r
6 for <notmuch@notmuchmail.org>; Fri, 31 Jul 2015 12:12:47 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
11 X-Spam-Status: No, score=0.151 tagged_above=-999 required=5 tests=[AWL=0.151]
\r
13 Received: from arlo.cworth.org ([127.0.0.1])
\r
14 by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id k-xM8Gyk46dq for <notmuch@notmuchmail.org>;
\r
16 Fri, 31 Jul 2015 12:12:45 -0700 (PDT)
\r
17 Received: from gitolite.debian.net (gitolite.debian.net [87.98.215.224])
\r
18 by arlo.cworth.org (Postfix) with ESMTPS id 603FE6DE09FB
\r
19 for <notmuch@notmuchmail.org>; Fri, 31 Jul 2015 12:12:45 -0700 (PDT)
\r
20 Received: from remotemail by gitolite.debian.net with local (Exim 4.80)
\r
21 (envelope-from <david@tethera.net>)
\r
22 id 1ZLFi9-0002MY-Dg; Fri, 31 Jul 2015 19:11:17 +0000
\r
23 Received: (nullmailer pid 13061 invoked by uid 1000); Fri, 31 Jul 2015
\r
25 From: David Bremner <david@tethera.net>
\r
26 To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org
\r
27 Subject: Re: [PATCH 1/4] cli: show: allow sort order to be specified
\r
28 In-Reply-To: <1435359035-6767-2-git-send-email-markwalters1009@gmail.com>
\r
29 References: <1435359035-6767-1-git-send-email-markwalters1009@gmail.com>
\r
30 <1435359035-6767-2-git-send-email-markwalters1009@gmail.com>
\r
31 User-Agent: Notmuch/0.20.2 (http://notmuchmail.org) Emacs/24.5.1
\r
32 (x86_64-pc-linux-gnu)
\r
33 Date: Fri, 31 Jul 2015 21:11:02 +0200
\r
34 Message-ID: <87d1z8f8hl.fsf@maritornes.cs.unb.ca>
\r
36 Content-Type: text/plain
\r
37 X-BeenThere: notmuch@notmuchmail.org
\r
38 X-Mailman-Version: 2.1.18
\r
40 List-Id: "Use and development of the notmuch mail system."
\r
41 <notmuch.notmuchmail.org>
\r
42 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
43 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
44 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>
\r
45 List-Post: <mailto:notmuch@notmuchmail.org>
\r
46 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
47 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
48 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
49 X-List-Received-Date: Fri, 31 Jul 2015 19:12:47 -0000
\r
51 Mark Walters <markwalters1009@gmail.com> writes:
\r
53 > This allows the sort to be specified in the notmuch show command with
\r
56 > Note that individual threads are still displayed in oldest first
\r
57 > order, but if the search has multiple threads then these are ordered
\r
58 > according to this option. This should mean that most callers won't
\r
59 > notice the option (e.g. the emacs show mode) as they only call show on
\r
60 > individual threads, but other users, particularly the emacs tree view,
\r
63 > doc/man1/notmuch-show.rst | 17 +++++++++++++++++
\r
64 > notmuch-show.c | 8 ++++++++
\r
65 > 2 files changed, 25 insertions(+)
\r
67 > diff --git a/doc/man1/notmuch-show.rst b/doc/man1/notmuch-show.rst
\r
68 > index 9eb5198..7717b08 100644
\r
69 > --- a/doc/man1/notmuch-show.rst
\r
70 > +++ b/doc/man1/notmuch-show.rst
\r
71 > @@ -97,6 +97,23 @@ Supported options for **show** include
\r
72 > intended for programs that invoke **notmuch(1)** internally. If
\r
73 > omitted, the latest supported version will be used.
\r
75 > + ``--sort=``\ (**newest-first**\ \|\ **oldest-first**)
\r
76 > + This option can be used to present results in either
\r
77 > + chronological order (**oldest-first**) or reverse chronological
\r
78 > + order (**newest-first**).
\r
80 > + Note: This only affects the order of messages in different
\r
81 > + threads: messages inside a thread will always be presented in
\r
84 This phrasing is pretty confusing to me. What about saying something
\r
87 This option can be used to present _threads_ in either ...
\r
89 Note: this only affects the ordering of threads: messages inside a
\r
90 thread will always be presented in thread order.
\r
92 > However, the order of the threads will be distinct
\r
93 > + between these two options (beyond being simply reversed). When
\r
94 > + sorting by **oldest-first** the threads will be sorted by the
\r
95 > + oldest message in each thread, but when sorting by
\r
96 > + **newest-first** the threads will be sorted by the newest
\r
97 > + message in each thread.
\r
99 > + By default, results will be displayed in reverse chronological
\r
100 > + order, (that is, the newest results will be displayed first).
\r
103 > Output the single decoded MIME part N of a single message. The
\r
104 > search terms must match only a single message. Message parts are
\r
105 > diff --git a/notmuch-show.c b/notmuch-show.c
\r
106 > index b80933a..ec9a915 100644
\r
107 > --- a/notmuch-show.c
\r
108 > +++ b/notmuch-show.c
\r
109 > @@ -1090,6 +1090,7 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])
\r
110 > int format_sel = NOTMUCH_FORMAT_NOT_SPECIFIED;
\r
111 > int exclude = EXCLUDE_TRUE;
\r
112 > int entire_thread = ENTIRE_THREAD_DEFAULT;
\r
113 > + notmuch_sort_t sort = NOTMUCH_SORT_NEWEST_FIRST;
\r
115 > notmuch_opt_desc_t options[] = {
\r
116 > { NOTMUCH_OPT_KEYWORD, &format_sel, "format", 'f',
\r
117 > @@ -1100,10 +1101,15 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])
\r
118 > { "raw", NOTMUCH_FORMAT_RAW },
\r
120 > { NOTMUCH_OPT_INT, ¬much_format_version, "format-version", 0, 0 },
\r
121 > + { NOTMUCH_OPT_KEYWORD, &sort, "sort", 's',
\r
122 > + (notmuch_keyword_t []){ { "oldest-first", NOTMUCH_SORT_OLDEST_FIRST },
\r
123 > + { "newest-first", NOTMUCH_SORT_NEWEST_FIRST },
\r
125 > { NOTMUCH_OPT_KEYWORD, &exclude, "exclude", 'x',
\r
126 > (notmuch_keyword_t []){ { "true", EXCLUDE_TRUE },
\r
127 > { "false", EXCLUDE_FALSE },
\r
130 looks like extra whitespace here
\r
131 > { NOTMUCH_OPT_KEYWORD, &entire_thread, "entire-thread", 't',
\r
132 > (notmuch_keyword_t []){ { "true", ENTIRE_THREAD_TRUE },
\r
133 > { "false", ENTIRE_THREAD_FALSE },
\r
134 > @@ -1233,6 +1239,8 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])
\r
135 > size_t search_exclude_tags_length;
\r
138 > + notmuch_query_set_sort (query, sort);
\r
141 hard to argue with that part ;)
\r