mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Use file notification in autorevert also for recreated files
* lisp/autorevert.el (auto-revert-mode) (global-auto-revert-mode, auto-revert-notify-add-watch) (auto-revert-notify-handler, auto-revert-handler): Do not use buffer local `auto-revert-use-notify' anymore. * test/lisp/autorevert-tests.el (auto-revert-test02-auto-revert-deleted-file): Adapt test in order to check, that file notification is reenabled when possible.
This commit is contained in:
parent
5b64f18134
commit
530bb2dc68
2 changed files with 39 additions and 43 deletions
|
|
@ -161,7 +161,7 @@ This expects `auto-revert--messages' to be bound by
|
|||
:tags '(:expensive-test)
|
||||
|
||||
(let ((tmpfile (make-temp-file "auto-revert-test"))
|
||||
buf)
|
||||
buf desc)
|
||||
(unwind-protect
|
||||
(progn
|
||||
(write-region "any text" nil tmpfile nil 'no-message)
|
||||
|
|
@ -174,6 +174,7 @@ This expects `auto-revert--messages' to be bound by
|
|||
(sleep-for 1)
|
||||
(auto-revert-mode 1)
|
||||
(should auto-revert-mode)
|
||||
(setq desc auto-revert-notify-watch-descriptor)
|
||||
|
||||
;; Remove file while reverting. We simulate this by
|
||||
;; modifying `before-revert-hook'.
|
||||
|
|
@ -192,7 +193,7 @@ This expects `auto-revert--messages' to be bound by
|
|||
(should (string-match "any text" (buffer-string)))
|
||||
;; With w32notify, the 'stopped' events are not sent.
|
||||
(or (eq file-notify--library 'w32notify)
|
||||
(should-not auto-revert-use-notify))
|
||||
(should-not auto-revert-notify-watch-descriptor))
|
||||
|
||||
;; Once the file has been recreated, the buffer shall be
|
||||
;; reverted.
|
||||
|
|
@ -203,6 +204,11 @@ This expects `auto-revert--messages' to be bound by
|
|||
(auto-revert--wait-for-revert buf))
|
||||
;; Check, that the buffer has been reverted.
|
||||
(should (string-match "another text" (buffer-string)))
|
||||
;; When file notification is used, it must be reenabled
|
||||
;; after recreation of the file. We cannot expect that
|
||||
;; the descriptor is the same, so we just check the
|
||||
;; existence.
|
||||
(should (eq (null desc) (null auto-revert-notify-watch-descriptor)))
|
||||
|
||||
;; An empty file shall still be reverted.
|
||||
(ert-with-message-capture auto-revert--messages
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue