Don't autorevert if minibuffer is active

Some ivy/helm commands allow you to preview buffers, which is not an
appropriate time to (invisibly) revert them. The message could be missed
and expensive machinary could be triggered (e.g. updating git-gutter),
which could appear slow. Best to defer reverting until the user has
deliberately landed on the target, and is more likely to notice a revert
notification in the minibuffer.

Suggested by @flatwhatson
This commit is contained in:
Henrik Lissner 2019-10-20 09:33:07 -04:00
parent c109acd6fd
commit 70e6c17de5
No known key found for this signature in database
GPG Key ID: 5F6C0EA160557395

View File

@ -153,16 +153,16 @@ possible."
;; changes when we switch to a buffer or when we focus the Emacs frame.
(defun doom-auto-revert-buffer-h ()
"Auto revert current buffer, if necessary."
(unless auto-revert-mode
(unless (or auto-revert-mode (active-minibuffer-window))
;; Only prompts for confirmation when buffer is unsaved.
(let ((revert-without-query (list ".")))
(auto-revert-handler))))
(defun doom-auto-revert-buffers-h ()
"Auto revert's stale buffers (that are visible)."
(unless auto-revert-mode
(dolist (buf (doom-visible-buffers))
(with-current-buffer buf
(doom-auto-revert-buffer-h))))))
"Auto revert stale buffers in visible windows, if necessary."
(dolist (buf (doom-visible-buffers))
(with-current-buffer buf
(doom-auto-revert-buffer-h)))))
(use-package! recentf