summaryrefslogtreecommitdiff
path: root/doc/lispref/hooks.texi
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 /doc/lispref/hooks.texi
parent2bf0b3bf6183c1da9b5dee789c7aa3241ca93441 (diff)
downloademacs-e9f9827eb01a382bead6c180f6703322167e6f89.tar.gz
emacs-e9f9827eb01a382bead6c180f6703322167e6f89.tar.bz2
emacs-e9f9827eb01a382bead6c180f6703322167e6f89.zip
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 'doc/lispref/hooks.texi')
-rw-r--r--doc/lispref/hooks.texi1
1 files changed, 1 insertions, 0 deletions
diff --git a/doc/lispref/hooks.texi b/doc/lispref/hooks.texi
index 71992464e09..f775aa4d4b0 100644
--- a/doc/lispref/hooks.texi
+++ b/doc/lispref/hooks.texi
@@ -251,6 +251,7 @@ I thought did not need to be mentioned here:
Lisp:
after-load-functions
+after-set-visited-file-name-hook
auto-coding-functions
choose-completion-string-functions
completing-read-function