Lazy Revert is a very simple package that provides an alternative auto-revert solution extracted from Doom Emacs.
It only reverts visible buffers when the user: a. saves a file b. switches to a buffer (or its window) c. focuses Emacs (after using another program)
Thank @hlissner for the original implementation.
An example of using use-package
and quelpa
:
(use-package lazy-revert
:ensure nil
:quelpa (lazy-revert :fetcher github
:repo "yilin-zhang/lazy-revert")
:hook (after-init . lazy-revert-mode)
;; Optional
:config
(setq auto-revert-verbose t ; let us know when it happens
auto-revert-use-notify nil
auto-revert-stop-on-user-input nil
;; Only prompts for confirmation when buffer is unsaved.
revert-without-query (list ".")))
Make sure you have global-auto-revert-mode
and auto-revert-mode
disabled,
then simply enable lazy-revert-mode
, which is a global minor mode.