summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2019-05-09 09:40:46 +0200
committerMattias EngdegÄrd <mattiase@acm.org>2019-05-20 11:26:51 +0200
commite9f9827eb01a382bead6c180f6703322167e6f89 (patch)
tree497784bbe60ffcd6985ea785481a5d382862e509 /etc
parent2bf0b3bf6183c1da9b5dee789c7aa3241ca93441 (diff)
downloademacs-e9f9827eb01a382bead6c180f6703322167e6f89.tar.gz
Avoid polling in global-auto-revert-mode (bug#35418)
Make `auto-revert-avoid-polling' have effect in global-auto-revert-mode. Buffers actually handled by that mode are marked with a non-nil value of `auto-revert--global-mode'. When global-auto-revert-mode is entered, eligible buffers are marked in that way, and hooks are set up to mark new buffers and take care of buffers whose file names change. This way the existing poll-avoidance logic can be used, since the entire set of buffers in auto-revert is known. A new hook, `after-set-visited-file-name-hook', was added to handle the case when the file name of a tracked buffer changes. * lisp/autorevert.el (auto-revert-avoid-polling): Amend doc string. (auto-revert--global-mode): New buffer-local variable. (global-auto-revert-mode): Mark existing buffers and set up hooks when mode is entered; do the opposite when exited. (auto-revert--global-add-current-buffer) (auto-revert--global-adopt-current-buffer) (auto-revert--set-visited-file-name-advice): New functions. (auto-revert--polled-buffers, auto-revert--need-polling-p) (auto-revert-notify-handler) (auto-revert-active-p): Modify logic to cover global-auto-revert-mode. * lisp/files.el (after-set-visited-file-name-hook): New hook. (set-visited-file-name-hook): Call new hook. * test/lisp/autorevert-tests.el (top): Use lexical-binding. (auto-revert-test--write-file, auto-revert-test--buffer-string) (auto-revert-test--wait-for, auto-revert-test--wait-for-buffer-text) (auto-revert-test05-global-notify): New test. * doc/lispref/hooks.texi (Standard Hooks): Mention new hook (in a comment, since it's unclear whether it should actually be documented here) * etc/NEWS (Changes in Specialized Modes and Packages): Update entry.
Diffstat (limited to 'etc')
-rw-r--r--etc/NEWS3
1 files changed, 1 insertions, 2 deletions
diff --git a/etc/NEWS b/etc/NEWS
index d70cda179e0..9ca98c370e6 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1443,8 +1443,7 @@ When set to a non-nil value, buffers in Auto Revert mode are no longer
polled for changes periodically. This reduces the power consumption
of an idle Emacs, but may fail on some network file systems; set
'auto-revert-notify-exclude-dir-regexp' to match files where
-notification is not supported. The new variable currently has no
-effect in 'global-auto-revert-mode'. The default value is nil.
+notification is not supported. The default value is nil.
*** New variable 'buffer-auto-revert-by-notification'
A major mode can declare that notification on the buffer's default