From 89acde3f9c42a1b85ae8809b0eca2f610329df3a Mon Sep 17 00:00:00 2001 From: Sean Farley Date: Sun, 4 Sep 2022 16:54:24 -0500 Subject: [PATCH] mu4e-main: automatically update the mail counts after indexing It always struck me as a bit odd to force the user to refresh the main view after updating and indexing their mail. This change creates a hook that will simply call `revert-buffer' after an indexing completes. --- mu4e/mu4e-main.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mu4e/mu4e-main.el b/mu4e/mu4e-main.el index 380ee011..31cf4baf 100644 --- a/mu4e/mu4e-main.el +++ b/mu4e/mu4e-main.el @@ -118,7 +118,8 @@ the personal addresses.") (mu4e-context-minor-mode) (mu4e-search-minor-mode) (mu4e-update-minor-mode) - (set (make-local-variable 'revert-buffer-function) #'mu4e--main-view-real)) + (set (make-local-variable 'revert-buffer-function) #'mu4e--main-view-real) + (add-hook 'mu4e-index-updated-hook #'mu4e--main-update-after-index)) (defun mu4e--main-action-str (str &optional func-or-shortcut) @@ -417,5 +418,10 @@ When REFRESH is non nil refresh infos from server." (sit-for 1) (mu4e--main-menu)))) +(defun mu4e--main-update-after-index () + "Update the main view buffer after indexing." + (with-current-buffer mu4e-main-buffer-name + (revert-buffer))) + (provide 'mu4e-main) ;;; mu4e-main.el ends here