diff options
| author | Mattias EngdegÄrd | 2019-04-24 18:39:05 +0200 |
|---|---|---|
| committer | Mattias EngdegÄrd | 2019-04-30 13:25:52 +0200 |
| commit | c61bbb4c8e7e2f2068c1cfac9a001806a1969202 (patch) | |
| tree | 2708a16e72d6099b676c7e50d0ef11fe11e194c3 /doc | |
| parent | f478082f9ff22ff41fbd9616ebea75757f9a0311 (diff) | |
| download | emacs-c61bbb4c8e7e2f2068c1cfac9a001806a1969202.tar.gz emacs-c61bbb4c8e7e2f2068c1cfac9a001806a1969202.zip | |
Don't poll auto-revert files that use notification (bug#35418)
It is a waste to periodically poll files that use change notification
in auto-revert mode; stop doing that. If no files need polling,
turn off the periodic execution entirely to further avoid wasting power.
Use a timer to inhibit immediate reversion for some time after a
notification, for throttling.
This change does not apply to files in global-auto-revert-mode, where
polling is still necessary. It is disabled by default, and enabled by
setting `auto-revert-avoid-polling' to non-nil.
* lisp/autorevert.el
(toplevel): Require cl-lib.
(auto-revert-avoid-polling, auto-revert--polled-buffers)
(auto-revert--need-polling-p, auto-revert--lockout-interval)
(auto-revert--lockout-timer, auto-revert--end-lockout): New.
(global-auto-revert-mode): Keep notifiers for buffers in auto-revert mode.
(auto-revert-set-timer): Use auto-revert--need-polling-p.
(auto-revert-notify-handler): Restart polling if notification stopped.
Use new lockout timer.
(auto-revert-buffers):
Use auto-revert--polled-buffers and auto-revert--need-polling-p.
(auto-revert-buffers-counter, auto-revert-buffers-counter-lockedout):
Remove.
* etc/NEWS (Changes in Specialized Modes and Packages):
Describe the new auto-revert-avoid-polling variable.
* doc/emacs/files.texi (Reverting):
Add paragraph describing auto-revert-avoid-polling.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/emacs/files.texi | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi index a57428230cc..990b8f16795 100644 --- a/doc/emacs/files.texi +++ b/doc/emacs/files.texi | |||
| @@ -988,6 +988,20 @@ the polling interval through the variable @code{auto-revert-interval}. | |||
| 988 | supported, @code{auto-revert-use-notify} will be @code{nil} by | 988 | supported, @code{auto-revert-use-notify} will be @code{nil} by |
| 989 | default. | 989 | default. |
| 990 | 990 | ||
| 991 | @vindex auto-revert-avoid-polling | ||
| 992 | @vindex auto-revert-notify-exclude-dir-regexp | ||
| 993 | By default, Auto-Revert mode will poll files for changes | ||
| 994 | periodically even when file notifications are used. Such polling is | ||
| 995 | usually unnecessary, and turning it off may save power by relying on | ||
| 996 | notifications only. To do so, set the variable | ||
| 997 | @code{auto-revert-avoid-polling} to non-@code{nil}. However, | ||
| 998 | notification is ineffective on certain file systems; mainly network | ||
| 999 | file system on Unix-like machines, where files can be altered from | ||
| 1000 | other machines. To force polling when | ||
| 1001 | @code{auto-revert-avoid-polling} is non-@code{nil}, set | ||
| 1002 | @code{auto-revert-notify-exclude-dir-regexp} to match files that | ||
| 1003 | should be excluded from using notification. | ||
| 1004 | |||
| 991 | One use of Auto-Revert mode is to ``tail'' a file such as a system | 1005 | One use of Auto-Revert mode is to ``tail'' a file such as a system |
| 992 | log, so that changes made to that file by other programs are | 1006 | log, so that changes made to that file by other programs are |
| 993 | continuously displayed. To do this, just move the point to the end of | 1007 | continuously displayed. To do this, just move the point to the end of |