From: jao <jao@gnu.org>
To: notmuch@notmuchmail.org
Cc: jao <jao@gnu.org>
Subject: [PATCH v3 1/5] CLI/show: accept --sort
Date: Fri, 2 Jul 2021 21:44:20 +0100 [thread overview]
Message-ID: <20210702204424.2018666-2-jao@gnu.org> (raw)
In-Reply-To: <20210702204424.2018666-1-jao@gnu.org>
Add the command-line option --sort to the show command of the CLI
notmuch interface, with the same possible values as the same option in
notmuch search.
---
notmuch-show.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/notmuch-show.c b/notmuch-show.c
index 232557d5..852afc8d 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -1249,8 +1249,13 @@ notmuch_show_command (notmuch_database_t *notmuch, int argc, char *argv[])
bool single_message;
bool unthreaded = FALSE;
notmuch_status_t status;
+ int sort = NOTMUCH_SORT_NEWEST_FIRST;
notmuch_opt_desc_t options[] = {
+ { .opt_keyword = &sort, .name = "sort", .keywords =
+ (notmuch_keyword_t []){ { "oldest-first", NOTMUCH_SORT_OLDEST_FIRST },
+ { "newest-first", NOTMUCH_SORT_NEWEST_FIRST },
+ { 0, 0 } } },
{ .opt_keyword = &format, .name = "format", .keywords =
(notmuch_keyword_t []){ { "json", NOTMUCH_FORMAT_JSON },
{ "text", NOTMUCH_FORMAT_TEXT },
@@ -1367,6 +1372,8 @@ notmuch_show_command (notmuch_database_t *notmuch, int argc, char *argv[])
return EXIT_FAILURE;
}
+ notmuch_query_set_sort (query, sort);
+
/* Create structure printer. */
formatter = formatters[format];
sprinter = formatter->new_sprinter (notmuch, stdout);
--
2.32.0
next prev parent reply other threads:[~2021-07-02 20:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-02 20:44 New --sort for notmuch show emacs notmuch-tree-mode (v3) jao
2021-07-02 20:44 ` jao [this message]
2021-07-02 20:44 ` [PATCH v3 2/5] CLI/show: tests for the new --sort option jao
2021-07-02 20:44 ` [PATCH v3 3/5] emacs/hello: honouring :sort-order in threaded queries jao
2021-07-02 20:44 ` [PATCH v3 4/5] emacs/tree: command to toggle search sort order in tree mode jao
2021-07-02 20:44 ` [PATCH v3 5/5] doc: new notmuch show --sort and related emacs commands jao
2021-07-03 23:45 ` New --sort for notmuch show emacs notmuch-tree-mode (v3) David Bremner
2021-07-03 23:52 ` jao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210702204424.2018666-2-jao@gnu.org \
--to=jao@gnu.org \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).