From 20e224d5ce902b69ceb47fe68a2b1ed9212735a9 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Fri, 31 Jul 2015 21:11:02 +0200 Subject: [PATCH] Re: [PATCH 1/4] cli: show: allow sort order to be specified --- 00/168f570acc261411631ed9250e9945a8dbbe96 | 142 ++++++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 00/168f570acc261411631ed9250e9945a8dbbe96 diff --git a/00/168f570acc261411631ed9250e9945a8dbbe96 b/00/168f570acc261411631ed9250e9945a8dbbe96 new file mode 100644 index 000000000..d27a138f3 --- /dev/null +++ b/00/168f570acc261411631ed9250e9945a8dbbe96 @@ -0,0 +1,142 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id 93CB26DE0A9A + for ; Fri, 31 Jul 2015 12:12:47 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: 0.151 +X-Spam-Level: +X-Spam-Status: No, score=0.151 tagged_above=-999 required=5 tests=[AWL=0.151] + autolearn=disabled +Received: from arlo.cworth.org ([127.0.0.1]) + by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id k-xM8Gyk46dq for ; + Fri, 31 Jul 2015 12:12:45 -0700 (PDT) +Received: from gitolite.debian.net (gitolite.debian.net [87.98.215.224]) + by arlo.cworth.org (Postfix) with ESMTPS id 603FE6DE09FB + for ; Fri, 31 Jul 2015 12:12:45 -0700 (PDT) +Received: from remotemail by gitolite.debian.net with local (Exim 4.80) + (envelope-from ) + id 1ZLFi9-0002MY-Dg; Fri, 31 Jul 2015 19:11:17 +0000 +Received: (nullmailer pid 13061 invoked by uid 1000); Fri, 31 Jul 2015 + 19:11:02 -0000 +From: David Bremner +To: Mark Walters , notmuch@notmuchmail.org +Subject: Re: [PATCH 1/4] cli: show: allow sort order to be specified +In-Reply-To: <1435359035-6767-2-git-send-email-markwalters1009@gmail.com> +References: <1435359035-6767-1-git-send-email-markwalters1009@gmail.com> + <1435359035-6767-2-git-send-email-markwalters1009@gmail.com> +User-Agent: Notmuch/0.20.2 (http://notmuchmail.org) Emacs/24.5.1 + (x86_64-pc-linux-gnu) +Date: Fri, 31 Jul 2015 21:11:02 +0200 +Message-ID: <87d1z8f8hl.fsf@maritornes.cs.unb.ca> +MIME-Version: 1.0 +Content-Type: text/plain +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.18 +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: Fri, 31 Jul 2015 19:12:47 -0000 + +Mark Walters writes: + +> This allows the sort to be specified in the notmuch show command with +> a --sort option. +> +> Note that individual threads are still displayed in oldest first +> order, but if the search has multiple threads then these are ordered +> according to this option. This should mean that most callers won't +> notice the option (e.g. the emacs show mode) as they only call show on +> individual threads, but other users, particularly the emacs tree view, +> can use it. +> --- +> doc/man1/notmuch-show.rst | 17 +++++++++++++++++ +> notmuch-show.c | 8 ++++++++ +> 2 files changed, 25 insertions(+) +> +> diff --git a/doc/man1/notmuch-show.rst b/doc/man1/notmuch-show.rst +> index 9eb5198..7717b08 100644 +> --- a/doc/man1/notmuch-show.rst +> +++ b/doc/man1/notmuch-show.rst +> @@ -97,6 +97,23 @@ Supported options for **show** include +> intended for programs that invoke **notmuch(1)** internally. If +> omitted, the latest supported version will be used. +> +> + ``--sort=``\ (**newest-first**\ \|\ **oldest-first**) +> + This option can be used to present results in either +> + chronological order (**oldest-first**) or reverse chronological +> + order (**newest-first**). +> + +> + Note: This only affects the order of messages in different +> + threads: messages inside a thread will always be presented in +> + thread order. + +This phrasing is pretty confusing to me. What about saying something +like + +This option can be used to present _threads_ in either ... + +Note: this only affects the ordering of threads: messages inside a +thread will always be presented in thread order. + +> However, the order of the threads will be distinct +> + between these two options (beyond being simply reversed). When +> + sorting by **oldest-first** the threads will be sorted by the +> + oldest message in each thread, but when sorting by +> + **newest-first** the threads will be sorted by the newest +> + message in each thread. +> + +> + By default, results will be displayed in reverse chronological +> + order, (that is, the newest results will be displayed first). +> + +> ``--part=N`` +> Output the single decoded MIME part N of a single message. The +> search terms must match only a single message. Message parts are +> diff --git a/notmuch-show.c b/notmuch-show.c +> index b80933a..ec9a915 100644 +> --- a/notmuch-show.c +> +++ b/notmuch-show.c +> @@ -1090,6 +1090,7 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[]) +> int format_sel = NOTMUCH_FORMAT_NOT_SPECIFIED; +> int exclude = EXCLUDE_TRUE; +> int entire_thread = ENTIRE_THREAD_DEFAULT; +> + notmuch_sort_t sort = NOTMUCH_SORT_NEWEST_FIRST; +> +> notmuch_opt_desc_t options[] = { +> { NOTMUCH_OPT_KEYWORD, &format_sel, "format", 'f', +> @@ -1100,10 +1101,15 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[]) +> { "raw", NOTMUCH_FORMAT_RAW }, +> { 0, 0 } } }, +> { NOTMUCH_OPT_INT, ¬much_format_version, "format-version", 0, 0 }, +> + { NOTMUCH_OPT_KEYWORD, &sort, "sort", 's', +> + (notmuch_keyword_t []){ { "oldest-first", NOTMUCH_SORT_OLDEST_FIRST }, +> + { "newest-first", NOTMUCH_SORT_NEWEST_FIRST }, +> + { 0, 0 } } }, +> { NOTMUCH_OPT_KEYWORD, &exclude, "exclude", 'x', +> (notmuch_keyword_t []){ { "true", EXCLUDE_TRUE }, +> { "false", EXCLUDE_FALSE }, +> { 0, 0 } } }, +> + +looks like extra whitespace here +> { NOTMUCH_OPT_KEYWORD, &entire_thread, "entire-thread", 't', +> (notmuch_keyword_t []){ { "true", ENTIRE_THREAD_TRUE }, +> { "false", ENTIRE_THREAD_FALSE }, +> @@ -1233,6 +1239,8 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[]) +> size_t search_exclude_tags_length; +> unsigned int i; +> +> + notmuch_query_set_sort (query, sort); +> + + +hard to argue with that part ;) + -- 2.26.2