diff options
author | Mattias EngdegÄrd <mattiase@acm.org> | 2019-05-08 00:02:59 +0200 |
---|---|---|
committer | Mattias EngdegÄrd <mattiase@acm.org> | 2019-05-18 14:16:21 +0200 |
commit | 1943220d1b7ed28b2708c86acfe5493d5c6e3089 (patch) | |
tree | 463bdfba333ec0637376d9fe4fc144fbc07bde0d /lisp/autorevert.el | |
parent | 4bf447bb912d73c4637f1094c265994dd99ff7e8 (diff) | |
download | emacs-1943220d1b7ed28b2708c86acfe5493d5c6e3089.tar.gz emacs-1943220d1b7ed28b2708c86acfe5493d5c6e3089.tar.bz2 emacs-1943220d1b7ed28b2708c86acfe5493d5c6e3089.zip |
Don't use file notification on non-file buffers
Allow non-file buffers to declare that notification on their
default-directory is sufficient to know when auto-revert updates are
required by setting the new variable `buffer-auto-revert-by-notification'
to non-nil. If nil, the default, then auto-revert will poll
those buffers instead. (bug#35418).
Currently, only Dired sets that variable.
* lisp/autorevert.el (auto-revert-buffers):
Modify condition for using notification.
* lisp/files.el (buffer-auto-revert-by-notification): New variable.
* lisp/dired.el (dired-mode): Set buffer-auto-revert-by-notification.
* doc/emacs/arevert-xtra.texi (Non-File Buffers): Document new variable.
* etc/NEWS (Changes in Specialized Modes and Packages): Describe new variable.
Diffstat (limited to 'lisp/autorevert.el')
-rw-r--r-- | lisp/autorevert.el | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lisp/autorevert.el b/lisp/autorevert.el index 7cd5e7ee8bf..197a2bf1578 100644 --- a/lisp/autorevert.el +++ b/lisp/autorevert.el @@ -858,8 +858,12 @@ the timer when no buffers need to be checked." (auto-revert-remove-current-buffer)) (when (auto-revert-active-p) ;; Enable file notification. + ;; Don't bother creating a notifier for non-file buffers + ;; unless it explicitly indicates that this works. (when (and auto-revert-use-notify - (not auto-revert-notify-watch-descriptor)) + (not auto-revert-notify-watch-descriptor) + (or buffer-file-name + buffer-auto-revert-by-notification)) (auto-revert-notify-add-watch)) (auto-revert-handler))))) (setq bufs (cdr bufs))) |