diff options
author | David Edmondson <dme@dme.org> | 2011-12-20 08:01:46 +0000 |
---|---|---|
committer | David Bremner <bremner@debian.org> | 2011-12-20 08:10:36 -0400 |
commit | 4a2a271878ad31992f3121362d7e2dd12da2bf7a (patch) | |
tree | b1f521e5d4fa33198cbad1319909641a34b72737 /emacs/notmuch.el | |
parent | 59adb2da193efef806b37e2c85981024a39ee2e3 (diff) |
emacs: Add `notmuch-jump-to-recent-buffer'.
From a Carl Worth idea: add a function which will select the most
recently used notmuch buffer (search, show or hello). If no recent
buffer is found, run `notmuch'.
It is expected that the user will global bind this command to a key
sequence.
Diffstat (limited to 'emacs/notmuch.el')
-rw-r--r-- | emacs/notmuch.el | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 675a1105..982b7d3f 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -1055,6 +1055,23 @@ current search results AND that are tagged with the given tag." (interactive) (notmuch-hello)) +;;;###autoload +(defun notmuch-jump-to-recent-buffer () + "Jump to the most recent notmuch buffer (search, show or hello). + +If no recent buffer is found, run `notmuch'." + (interactive) + (let ((last + (loop for buffer in (buffer-list) + if (with-current-buffer buffer + (memq major-mode '(notmuch-show-mode + notmuch-search-mode + notmuch-hello-mode))) + return buffer))) + (if last + (switch-to-buffer last) + (notmuch)))) + (setq mail-user-agent 'notmuch-user-agent) (provide 'notmuch) |