mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-22 02:48:08 +01:00
emacs/hello: honouring :sort-order in threaded queries
Now that notmuch show accepts --sort, we can, on the emacs side, use it according to the value of :sort-order in the definition of saved queries.
This commit is contained in:
parent
13d49b8e16
commit
74ab62a340
2 changed files with 9 additions and 5 deletions
|
@ -484,7 +484,9 @@ diagonal."
|
||||||
(defun notmuch-hello-widget-search (widget &rest _ignore)
|
(defun notmuch-hello-widget-search (widget &rest _ignore)
|
||||||
(cl-case (widget-get widget :notmuch-search-type)
|
(cl-case (widget-get widget :notmuch-search-type)
|
||||||
(tree
|
(tree
|
||||||
(notmuch-tree (widget-get widget :notmuch-search-terms)))
|
(notmuch-tree (widget-get widget :notmuch-search-terms)
|
||||||
|
nil nil nil nil nil nil
|
||||||
|
(widget-get widget :notmuch-search-oldest-first)))
|
||||||
(unthreaded
|
(unthreaded
|
||||||
(notmuch-unthreaded (widget-get widget :notmuch-search-terms)))
|
(notmuch-unthreaded (widget-get widget :notmuch-search-terms)))
|
||||||
(t
|
(t
|
||||||
|
|
|
@ -1064,7 +1064,8 @@ Complete list of currently available key bindings:
|
||||||
(notmuch-sexp-parse-partial-list 'notmuch-tree-insert-forest-thread
|
(notmuch-sexp-parse-partial-list 'notmuch-tree-insert-forest-thread
|
||||||
results-buf)))))
|
results-buf)))))
|
||||||
|
|
||||||
(defun notmuch-tree-worker (basic-query &optional query-context target open-target unthreaded)
|
(defun notmuch-tree-worker (basic-query &optional query-context target
|
||||||
|
open-target unthreaded oldest-first)
|
||||||
"Insert the tree view of the search in the current buffer.
|
"Insert the tree view of the search in the current buffer.
|
||||||
|
|
||||||
This is is a helper function for notmuch-tree. The arguments are
|
This is is a helper function for notmuch-tree. The arguments are
|
||||||
|
@ -1090,6 +1091,7 @@ the same as for the function notmuch-tree."
|
||||||
(let* ((search-args (concat basic-query
|
(let* ((search-args (concat basic-query
|
||||||
(and query-context
|
(and query-context
|
||||||
(concat " and (" query-context ")"))))
|
(concat " and (" query-context ")"))))
|
||||||
|
(sort-arg (if oldest-first "--sort=oldest-first" "--sort=newest-first"))
|
||||||
(message-arg (if unthreaded "--unthreaded" "--entire-thread")))
|
(message-arg (if unthreaded "--unthreaded" "--entire-thread")))
|
||||||
(when (equal (car (process-lines notmuch-command "count" search-args)) "0")
|
(when (equal (car (process-lines notmuch-command "count" search-args)) "0")
|
||||||
(setq search-args basic-query))
|
(setq search-args basic-query))
|
||||||
|
@ -1097,7 +1099,7 @@ the same as for the function notmuch-tree."
|
||||||
(let ((proc (notmuch-start-notmuch
|
(let ((proc (notmuch-start-notmuch
|
||||||
"notmuch-tree" (current-buffer) #'notmuch-tree-process-sentinel
|
"notmuch-tree" (current-buffer) #'notmuch-tree-process-sentinel
|
||||||
"show" "--body=false" "--format=sexp" "--format-version=4"
|
"show" "--body=false" "--format=sexp" "--format-version=4"
|
||||||
message-arg search-args))
|
sort-arg message-arg search-args))
|
||||||
;; Use a scratch buffer to accumulate partial output.
|
;; Use a scratch buffer to accumulate partial output.
|
||||||
;; This buffer will be killed by the sentinel, which
|
;; This buffer will be killed by the sentinel, which
|
||||||
;; should be called no matter how the process dies.
|
;; should be called no matter how the process dies.
|
||||||
|
@ -1116,7 +1118,7 @@ the same as for the function notmuch-tree."
|
||||||
notmuch-tree-basic-query))
|
notmuch-tree-basic-query))
|
||||||
|
|
||||||
(defun notmuch-tree (&optional query query-context target buffer-name
|
(defun notmuch-tree (&optional query query-context target buffer-name
|
||||||
open-target unthreaded parent-buffer)
|
open-target unthreaded parent-buffer oldest-first)
|
||||||
"Display threads matching QUERY in tree view.
|
"Display threads matching QUERY in tree view.
|
||||||
|
|
||||||
The arguments are:
|
The arguments are:
|
||||||
|
@ -1145,7 +1147,7 @@ The arguments are:
|
||||||
(pop-to-buffer-same-window buffer))
|
(pop-to-buffer-same-window buffer))
|
||||||
;; Don't track undo information for this buffer
|
;; Don't track undo information for this buffer
|
||||||
(setq buffer-undo-list t)
|
(setq buffer-undo-list t)
|
||||||
(notmuch-tree-worker query query-context target open-target unthreaded)
|
(notmuch-tree-worker query query-context target open-target unthreaded oldest-first)
|
||||||
(setq notmuch-tree-parent-buffer parent-buffer)
|
(setq notmuch-tree-parent-buffer parent-buffer)
|
||||||
(setq truncate-lines t))
|
(setq truncate-lines t))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue