mu4e: support jumping to previous/next thread

in headers view, message view with '{' and '}.
Also update documentation.

Fixes #1523
This commit is contained in:
Dirk-Jan C. Binnema
2023-02-12 12:55:34 +02:00
parent 88cb22d178
commit 92ac6de09c
3 changed files with 46 additions and 8 deletions

View File

@ -923,6 +923,9 @@ after the end of the search results."
(define-key map (kbd "[") #'mu4e-headers-prev-unread)
(define-key map (kbd "]") #'mu4e-headers-next-unread)
(define-key map (kbd "{") #'mu4e-headers-prev-thread)
(define-key map (kbd "}") #'mu4e-headers-next-thread)
;; change the number of headers
(define-key map (kbd "C-+") #'mu4e-headers-split-view-grow)
(define-key map (kbd "C--") #'mu4e-headers-split-view-shrink)
@ -1467,7 +1470,7 @@ previous header."
(defun mu4e~headers-prev-or-next-unread (backwards)
"Move point to the next message that is unread (and
untrashed). If BACKWARDS is non-`nil', move backwards."
(interactive)
(interactive "P")
(or (mu4e-headers-find-if-next
(lambda (msg)
(let ((flags (mu4e-message-field msg :flags)))
@ -1488,6 +1491,26 @@ untrashed)."
(interactive)
(mu4e~headers-prev-or-next-unread nil))
(defun mu4e~headers-prev-or-next-thread (backwards)
"Move point to the top of the next thread.
If BACKWARDS is non-`nil', move backwards."
(interactive "P")
(or (mu4e-headers-find-if-next
(lambda (msg)
(eq 0 (plist-get (plist-get msg :meta) :level)))
backwards)
(mu4e-message (format "No %s thread found"
(if backwards "previous" "next")))))
(defun mu4e-headers-prev-thread ()
"Move point to the previous thread."
(interactive) (mu4e~headers-prev-or-next-thread t))
(defun mu4e-headers-next-thread ()
"Move point to the previous thread."
(interactive) (mu4e~headers-prev-or-next-thread nil))
(defun mu4e-headers-split-view-grow (&optional n)
"In split-view, grow the headers window.
In horizontal split-view, increase the number of lines shown by N.