From dc5f27c89938e46eb6c5f197a9918031f3a1448d Mon Sep 17 00:00:00 2001 From: djcb Date: Wed, 24 Oct 2012 23:49:26 +0300 Subject: [PATCH] * mu4e: check for marks when auto-updating (don't do it if there are any) --- mu4e/mu4e-headers.el | 4 +++- mu4e/mu4e-mark.el | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/mu4e/mu4e-headers.el b/mu4e/mu4e-headers.el index 55654f7c..f4909725 100644 --- a/mu4e/mu4e-headers.el +++ b/mu4e/mu4e-headers.el @@ -655,7 +655,9 @@ after the end of the search results." "Update the current headers buffer after indexing has brought some changes, `mu4e-headers-auto-update' is non-nil and there is no user-interaction ongoing." - (when (and mu4e-headers-auto-update (not (active-minibuffer-window))) + (when (and mu4e-headers-auto-update ;; must be set + (zerop (mu4e-mark-marks-num)) ;; non active marks + (not (active-minibuffer-window))) ;; no user input (with-current-buffer mu4e~headers-buffer (mu4e-headers-rerun-search)))) nil t) diff --git a/mu4e/mu4e-mark.el b/mu4e/mu4e-mark.el index cb324992..28ab625a 100644 --- a/mu4e/mu4e-mark.el +++ b/mu4e/mu4e-mark.el @@ -302,6 +302,9 @@ If NO-CONFIRMATION is non-nil, don't ask user for confirmation." (when (gethash docid mu4e~mark-map) t)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun mu4e-mark-marks-num () + "Return the number of marks in the current buffer." + (if mu4e~mark-map (hash-table-count mu4e~mark-map) 0)) (defun mu4e-mark-handle-when-leaving () "If there are any marks in the current buffer, handle those @@ -309,12 +312,12 @@ according to the value of `mu4e-headers-leave-behavior'. This function is to be called before any further action (like searching, quiting the buffer) is taken; returning t means 'take the following action', return nil means 'don't do anything'" - (let ((marknum (if mu4e~mark-map (hash-table-count mu4e~mark-map) 0)) + (let ((marknum (mu4e-mark-marks-num)) (what mu4e-headers-leave-behavior)) (unless (zerop marknum) ;; nothing to do? (when (eq what 'ask) (setq what (mu4e-read-option - "There are existing marks; should we: " + (format "There are %d existing mark(s); should we: " marknum) '( ("apply marks" . apply) ("ignore marks?" . ignore))))) ;; we determined what to do... now do it