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 ()
|
(defun mu4e~headers-maybe-auto-update ()
|
||||||
"Update the current headers buffer after indexing changes.
|
"Update the current headers buffer after indexing changes.
|
||||||
|
|
||||||
Furthermore, `mu4e-headers-auto-update' is non-nil and there is
|
Furthermore, `mu4e-headers-auto-update' is non-nil and there is
|
||||||
no user-interaction ongoing."
|
no user-interaction ongoing.
|
||||||
(when (and mu4e-headers-auto-update ;; must be set
|
|
||||||
mu4e-index-update-status
|
We only update headers when quite a few conditions are true --
|
||||||
(not (mu4e-get-view-buffer)) ;; not when viewing a message
|
see the code."
|
||||||
(not (zerop (plist-get mu4e-index-update-status :updated)))
|
(when-let* ((hdrsbuf (mu4e-get-headers-buffer)))
|
||||||
;; NOTE: `mu4e-mark-marks-num' can return nil. Is that intended?
|
(when (and mu4e-headers-auto-update ;; must be set
|
||||||
(zerop (or (mu4e-mark-marks-num) 0)) ;; non active marks
|
mu4e-index-update-status
|
||||||
(not (active-minibuffer-window))) ;; no user input only
|
(not (mu4e-get-view-buffer)) ;; not when viewing a message
|
||||||
;; rerun search if there's a live window with search results;
|
(not (zerop (plist-get mu4e-index-update-status :updated)))
|
||||||
;; otherwise we'd trigger a headers view from out of nowhere.
|
(buffer-live-p hdrsbuf)
|
||||||
(when (and (buffer-live-p (mu4e-get-headers-buffer))
|
(window-live-p (get-buffer-window hdrsbuf t))
|
||||||
(window-live-p (get-buffer-window (mu4e-get-headers-buffer) 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))
|
(let ((mu4e--search-background t))
|
||||||
(mu4e-search-rerun)))))
|
(mu4e-search-rerun)))))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user