mu4e: fix mu4e~headers-maybe-auto-update
The check for # of marked message was flawed since mu4e-mark-marks-num should we called from the headers buffer (and wasn't, necessarily). Fixes #2779.
This commit is contained in:
@ -1093,19 +1093,23 @@ true, do *not* update the query history stack."
|
||||
|
||||
(defun mu4e~headers-maybe-auto-update ()
|
||||
"Update the current headers buffer after indexing changes.
|
||||
|
||||
Furthermore, `mu4e-headers-auto-update' is non-nil and there is
|
||||
no user-interaction ongoing."
|
||||
(when (and mu4e-headers-auto-update ;; must be set
|
||||
mu4e-index-update-status
|
||||
(not (mu4e-get-view-buffer)) ;; not when viewing a message
|
||||
(not (zerop (plist-get mu4e-index-update-status :updated)))
|
||||
;; NOTE: `mu4e-mark-marks-num' can return nil. Is that intended?
|
||||
(zerop (or (mu4e-mark-marks-num) 0)) ;; non active marks
|
||||
(not (active-minibuffer-window))) ;; no user input only
|
||||
;; rerun search if there's a live window with search results;
|
||||
;; otherwise we'd trigger a headers view from out of nowhere.
|
||||
(when (and (buffer-live-p (mu4e-get-headers-buffer))
|
||||
(window-live-p (get-buffer-window (mu4e-get-headers-buffer) t)))
|
||||
no user-interaction ongoing.
|
||||
|
||||
We only update headers when quite a few conditions are true --
|
||||
see the code."
|
||||
(when-let* ((hdrsbuf (mu4e-get-headers-buffer)))
|
||||
(when (and mu4e-headers-auto-update ;; must be set
|
||||
mu4e-index-update-status
|
||||
(not (mu4e-get-view-buffer)) ;; not when viewing a message
|
||||
(not (zerop (plist-get mu4e-index-update-status :updated)))
|
||||
(buffer-live-p hdrsbuf)
|
||||
(window-live-p (get-buffer-window hdrsbuf t))
|
||||
;; don't disturb marks.
|
||||
(zerop (or (with-current-buffer hdrsbuf (mu4e-mark-marks-num)) 0))
|
||||
(not (active-minibuffer-window))) ;; no user input only
|
||||
;; when all that is true, rerun the current query.
|
||||
(let ((mu4e--search-background t))
|
||||
(mu4e-search-rerun)))))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user