mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-21 18:38:08 +01:00
emacs: Cycle through notmuch buffers rather than jumping to the last.
As suggested by j4ni in #notmuch, rename `notmuch-jump-to-recent-buffer' as `notmuch-cycle-notmuch-buffers' and have it behave accordingly. Consider `message-mode' buffers to be of interest.
This commit is contained in:
parent
4b256ff557
commit
ef5c1d73f8
1 changed files with 31 additions and 13 deletions
|
@ -1069,21 +1069,39 @@ current search results AND that are tagged with the given tag."
|
||||||
(interactive)
|
(interactive)
|
||||||
(notmuch-hello))
|
(notmuch-hello))
|
||||||
|
|
||||||
;;;###autoload
|
(defun notmuch-interesting-buffer (b)
|
||||||
(defun notmuch-jump-to-recent-buffer ()
|
"Is the current buffer of interest to a notmuch user?"
|
||||||
"Jump to the most recent notmuch buffer (search, show or hello).
|
(with-current-buffer b
|
||||||
|
(memq major-mode '(notmuch-show-mode
|
||||||
|
notmuch-search-mode
|
||||||
|
notmuch-hello-mode
|
||||||
|
message-mode))))
|
||||||
|
|
||||||
If no recent buffer is found, run `notmuch'."
|
;;;###autoload
|
||||||
|
(defun notmuch-cycle-notmuch-buffers ()
|
||||||
|
"Cycle through any existing notmuch buffers (search, show or hello).
|
||||||
|
|
||||||
|
If the current buffer is the only notmuch buffer, bury it. If no
|
||||||
|
notmuch buffers exist, run `notmuch'."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((last
|
|
||||||
(loop for buffer in (buffer-list)
|
(let (start first)
|
||||||
if (with-current-buffer buffer
|
;; If the current buffer is a notmuch buffer, remember it and then
|
||||||
(memq major-mode '(notmuch-show-mode
|
;; bury it.
|
||||||
notmuch-search-mode
|
(when (notmuch-interesting-buffer (current-buffer))
|
||||||
notmuch-hello-mode)))
|
(setq start (current-buffer))
|
||||||
return buffer)))
|
(bury-buffer))
|
||||||
(if last
|
|
||||||
(switch-to-buffer last)
|
;; Find the first notmuch buffer.
|
||||||
|
(setq first (loop for buffer in (buffer-list)
|
||||||
|
if (notmuch-interesting-buffer buffer)
|
||||||
|
return buffer))
|
||||||
|
|
||||||
|
(if first
|
||||||
|
;; If the first one we found is any other than the starting
|
||||||
|
;; buffer, switch to it.
|
||||||
|
(unless (eq first start)
|
||||||
|
(switch-to-buffer first))
|
||||||
(notmuch))))
|
(notmuch))))
|
||||||
|
|
||||||
(setq mail-user-agent 'notmuch-user-agent)
|
(setq mail-user-agent 'notmuch-user-agent)
|
||||||
|
|
Loading…
Reference in a new issue