aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-07-02 21:44:23 +0100
committerDavid Bremner <david@tethera.net>2021-07-03 20:36:37 -0300
commite333debbd8092d19a600d01d9ab49bdf2a81c072 (patch)
tree4b8538c8467d473c8b9b06bb67b1a86252566f19
parent74ab62a34018b38a40db4d363fff3faae964b47a (diff)
emacs/tree: command to toggle search sort order in tree mode
New command notmuch-tree-toggle-order for switching the sort order (by reissuing the search with a different flag) in a notmuch-tree buffer.
-rw-r--r--emacs/notmuch-tree.el14
1 files changed, 13 insertions, 1 deletions
diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index 49d7659e..b288c05d 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -326,6 +326,7 @@ then NAME behaves like CMD."
(define-key map [remap notmuch-mua-new-mail] 'notmuch-tree-new-mail)
(define-key map [remap notmuch-jump-search] 'notmuch-tree-jump-search)
+ (define-key map "o" 'notmuch-tree-toggle-order)
(define-key map "S" 'notmuch-search-from-tree-current-query)
(define-key map "U" 'notmuch-unthreaded-from-tree-current-query)
(define-key map "Z" 'notmuch-tree-from-unthreaded-current-query)
@@ -751,7 +752,8 @@ nil otherwise."
query-context
target
nil
- unthreaded)))
+ unthreaded
+ notmuch-search-oldest-first)))
(defun notmuch-tree-thread-top ()
(when (notmuch-tree-get-message-properties)
@@ -1073,6 +1075,7 @@ the same as for the function notmuch-tree."
(interactive)
(notmuch-tree-mode)
(add-hook 'post-command-hook #'notmuch-tree-command-hook t t)
+ (setq notmuch-search-oldest-first oldest-first)
(setq notmuch-tree-unthreaded unthreaded)
(setq notmuch-tree-basic-query basic-query)
(setq notmuch-tree-query-context (if (or (string= query-context "")
@@ -1117,6 +1120,15 @@ the same as for the function notmuch-tree."
")")
notmuch-tree-basic-query))
+(defun notmuch-tree-toggle-order ()
+ "Toggle the current search order.
+
+This command toggles the sort order for the current search. The
+default sort order is defined by `notmuch-search-oldest-first'."
+ (interactive)
+ (setq notmuch-search-oldest-first (not notmuch-search-oldest-first))
+ (notmuch-tree-refresh-view))
+
(defun notmuch-tree (&optional query query-context target buffer-name
open-target unthreaded parent-buffer oldest-first)
"Display threads matching QUERY in tree view.