X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=emacs%2Fnotmuch-lib.el;h=58f3313d0bb92102bb1841fa3320ead9e68f36d7;hb=440b8065c9a3b6a892702c4a484398407bd702df;hp=9754e163983d5d17d6548bcd9f07a0caeadec119;hpb=ebd8a2e344bcbf2a4385e56d9328fae5b617e566;p=notmuch diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 9754e163..58f3313d 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -128,6 +128,17 @@ For example, if you wanted to remove an \"inbox\" tag and add an :group 'notmuch-search :group 'notmuch-show) +(defvar notmuch-common-keymap + (let ((map (make-sparse-keymap))) + (define-key map "?" 'notmuch-help) + (define-key map "q" 'notmuch-kill-this-buffer) + (define-key map "s" 'notmuch-search) + (define-key map "m" 'notmuch-mua-new-mail) + (define-key map "=" 'notmuch-refresh-this-buffer) + (define-key map "G" 'notmuch-poll-and-refresh-this-buffer) + map) + "Keymap shared by all notmuch modes.") + ;; By default clicking on a button does not select the window ;; containing the button (as opposed to clicking on a widget which ;; does). This means that the button action is then executed in the @@ -204,6 +215,25 @@ depending on the value of `notmuch-poll-script'." (interactive) (kill-buffer (current-buffer))) +(defvar notmuch-buffer-refresh-function nil + "Function to call to refresh the current buffer.") +(make-variable-buffer-local 'notmuch-buffer-refresh-function) + +(defun notmuch-refresh-this-buffer () + "Refresh the current buffer." + (interactive) + (when notmuch-buffer-refresh-function + (if (commandp notmuch-buffer-refresh-function) + ;; Pass prefix argument, etc. + (call-interactively notmuch-buffer-refresh-function) + (funcall notmuch-buffer-refresh-function)))) + +(defun notmuch-poll-and-refresh-this-buffer () + "Invoke `notmuch-poll' to import mail, then refresh the current buffer." + (interactive) + (notmuch-poll) + (notmuch-refresh-this-buffer)) + (defun notmuch-prettify-subject (subject) ;; This function is used by `notmuch-search-process-filter' which ;; requires that we not disrupt its' matching state. @@ -596,7 +626,6 @@ status." (defvar notmuch-show-process-crypto nil) (make-variable-buffer-local 'notmuch-show-process-crypto) - (provide 'notmuch-lib) ;; Local Variables: