unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: William Casarin <jb55@jb55.com>
To: notmuch@notmuchmail.org
Subject: [PATCH 6/6] emacs: add notmuch-search-change-order
Date: Mon, 25 Sep 2017 22:35:47 -0700	[thread overview]
Message-ID: <20170926053547.18564-7-jb55@jb55.com> (raw)
In-Reply-To: <20170926053547.18564-1-jb55@jb55.com>

notmuch-search-change-order pops up a completing-read minibuffer
completion window for choosing sort-orders.
---
 emacs/notmuch.el | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 334458b7..93b4e582 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -178,6 +178,7 @@ there will be called at other points of notmuch execution."
     (define-key map "r" 'notmuch-search-reply-to-thread-sender)
     (define-key map "R" 'notmuch-search-reply-to-thread)
     (define-key map "o" 'notmuch-search-toggle-order)
+    (define-key map "O" 'notmuch-search-change-order)
     (define-key map "c" 'notmuch-search-stash-map)
     (define-key map "t" 'notmuch-search-filter-by-tag)
     (define-key map "l" 'notmuch-search-filter)
@@ -1044,6 +1045,19 @@ same relative position within the new buffer."
     (subject-ascending 'subject-descending)
     (subject-descending 'subject-ascending)))
 
+(defun notmuch-search-change-order (&optional sort-order)
+  "Change the current search order.
+
+This command changes the order for current search. The default
+sort order is defuned by `notmuch-search-sort-order'."
+  (interactive)
+  (let ((so (if sort-order sort-order
+	      (cdr (assoc (completing-read
+			   "Select a sort order:" notmuch-sort-orders)
+			  notmuch-sort-orders)))))
+    (set 'notmuch-search-sort-order so)
+    (notmuch-search-refresh-view)))
+
 (defun notmuch-search-toggle-order ()
   "Toggle the current search order.
 
-- 
2.13.2

  parent reply	other threads:[~2017-09-26  5:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-26  5:35 [PATCH 0/6] Sort by from and subject William Casarin
2017-09-26  5:35 ` [PATCH 1/6] sorting: add the ability to sort " William Casarin
2017-09-26  5:35 ` [PATCH 2/6] sorting: update ruby bindings for " William Casarin
2017-09-26  5:35 ` [PATCH 3/6] sorting: update man page William Casarin
2017-09-26  5:35 ` [PATCH 4/6] emacs: replace oldest-first with sort-order William Casarin
2017-09-26  5:35 ` [PATCH 5/6] emacs: notmuch-search-orders William Casarin
2017-09-26  5:35 ` William Casarin [this message]
2017-09-30 10:10 ` [PATCH 0/6] Sort by from and subject Jani Nikula
2017-09-30 14:55   ` William Casarin
2017-09-30 15:29     ` Jani Nikula
2017-09-30 16:03       ` Mark Walters

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=20170926053547.18564-7-jb55@jb55.com \
    --to=jb55@jb55.com \
    --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).