aboutsummaryrefslogtreecommitdiffhomepage
path: root/emacs/notmuch-lib.el
diff options
context:
space:
mode:
authorGravatar Austin Clements <amdragon@MIT.EDU>2013-09-03 17:45:22 -0400
committerGravatar David Bremner <bremner@debian.org>2013-09-10 08:07:06 -0300
commit21474f0e09defa26421b356100c55299afeb19ef (patch)
tree6822df0c3958b9147c860babfbd51f2d278bec7a /emacs/notmuch-lib.el
parentebd8a2e344bcbf2a4385e56d9328fae5b617e566 (diff)
emacs: Add unified refresh-this-buffer function
This unifies the various refresh and poll-and-refresh functions we have for different modes. Now all modes bind "=" and "G" (except show, which doesn't bind "G" for some reason) to `notmuch-refresh-this-buffer' and `notmuch-poll-and-refresh-this-buffer', respectively.
Diffstat (limited to 'emacs/notmuch-lib.el')
-rw-r--r--emacs/notmuch-lib.el20
1 files changed, 19 insertions, 1 deletions
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 9754e163..782badb0 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -204,6 +204,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 +615,6 @@ status."
(defvar notmuch-show-process-crypto nil)
(make-variable-buffer-local 'notmuch-show-process-crypto)
-
(provide 'notmuch-lib)
;; Local Variables: