From 6537de11162cfea543cf8820546780aca9a5df9a Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Thu, 12 Aug 2021 13:08:52 +0300 Subject: [PATCH] mu4e: better feedback for lazy indexing Add `mu4e-update-index-nonlazy`, point users towards it. --- mu4e/mu4e-utils.el | 21 ++++++++++++++++++--- mu4e/mu4e-vars.el | 7 ++++++- mu4e/mu4e.texi | 8 ++++++-- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/mu4e/mu4e-utils.el b/mu4e/mu4e-utils.el index 9ab2fb39..8c143314 100644 --- a/mu4e/mu4e-utils.el +++ b/mu4e/mu4e-utils.el @@ -644,8 +644,13 @@ process." "Indexing... processed %d, updated %d" processed updated) (progn (mu4e-index-message - "Indexing completed; processed %d, updated %d, cleaned-up %d" - processed updated cleaned-up) + "%s completed; processed %d, updated %d, cleaned-up %d%s" + (if mu4e-index-lazy-check "Lazy indexing" "Indexing") + processed updated cleaned-up + (if (and mu4e-index-lazy-check + (not (eq mu4e-index-lazy-check 'lazy)) + (= 0 updated)) + " (consider M-x mu4e-update-nonlazy)" "")) ;; call the updated hook if anything changed. (unless (zerop (+ updated cleaned-up)) (run-hooks 'mu4e-index-updated-hook)) @@ -945,7 +950,17 @@ Also scrolls to the final line, and update the progress throbber." (defun mu4e-update-index () "Update the mu4e index." (interactive) - (mu4e~proc-index mu4e-index-cleanup mu4e-index-lazy-check)) + (mu4e~proc-index mu4e-index-cleanup mu4e-index-lazy-check)) + +(defun mu4e-update-index-nonlazy () + "Update the mu4e index non-lazily. +This is just a convenience wrapper for indexing the non-lazy way +if you otherwise want to use `mu4e-index-lazy-check'." + (interactive) + (let ((mu4e-index-cleanup nil) (mu4e-index-lazy-check nil)) + (mu4e-update-index))) + + (defvar mu4e~update-buffer nil "Internal, store the buffer of the update process when diff --git a/mu4e/mu4e-vars.el b/mu4e/mu4e-vars.el index d856efb0..bf1d5e6e 100644 --- a/mu4e/mu4e-vars.el +++ b/mu4e/mu4e-vars.el @@ -138,7 +138,12 @@ limitations: since directory timestamp changes do not traverse upwards and therefore this does not see changes in sub-directories: a change in 'bar' in 'Maildir/foo/bar/...' is not detected, only a change in 'foo'. In that case, this option -should not be set." +should not be set. + +Note: if no updated/new message were found during the lazy check, +mu4e will suggest using `mu4e-update-index-nonlazy'; if you do +not wish to see that suggestion, set `mu4e-index-lazy-check' to the +symbol `lazy'." :type 'boolean :group 'mu4e :safe 'booleanp) diff --git a/mu4e/mu4e.texi b/mu4e/mu4e.texi index 9d277196..2806c5dd 100644 --- a/mu4e/mu4e.texi +++ b/mu4e/mu4e.texi @@ -611,8 +611,12 @@ following: @end lisp In many cases, the mentioned thoroughness might not be needed, and -these settings give a very significant speed-up. Note that you can of -course occasionally run a thorough indexing round. +these settings give a very significant speed-up. If it does not work +for you (e.g., @t{mu4e} fails to find some new messages), simply leave +at the default. + +Note that you can occasionally run a thorough indexing round using +@code{mu4e-update-index-nonlazy}. For further details, please refer to the @t{mu-index} manpage; in particular, see @t{.noindex} and @t{.noupdate} which can help reducing