Finish changes in autorevert from commit 530bb2dc68

* lisp/autorevert.el (auto-revert-buffers):
Check `auto-revert-timer' being a timerp.

* test/lisp/filenotify-tests.el (file-notify-test04-autorevert):
Adapt test in order to cover changed behavior of autorevert.
This commit is contained in:
Michael Albinus 2018-01-22 09:12:16 +01:00
parent b3fb0d47c1
commit d0fd9809d7
2 changed files with 8 additions and 4 deletions

View file

@ -803,7 +803,8 @@ the timer when no buffers need to be checked."
;; Check if we should cancel the timer.
(when (and (not global-auto-revert-mode)
(null auto-revert-buffer-list))
(cancel-timer auto-revert-timer)
(if (timerp auto-revert-timer)
(cancel-timer auto-revert-timer))
(setq auto-revert-timer nil)))))

View file

@ -884,8 +884,8 @@ delivered."
;; Stop file notification. Autorevert shall still work via polling.
(file-notify-rm-watch auto-revert-notify-watch-descriptor)
(file-notify--wait-for-events
timeout (null auto-revert-use-notify))
(should-not auto-revert-use-notify)
timeout (null auto-revert-notify-watch-descriptor))
(should auto-revert-use-notify)
(should-not auto-revert-notify-watch-descriptor)
;; Modify file. We wait for two seconds, in order to
@ -902,7 +902,10 @@ delivered."
(string-match
(format-message "Reverting buffer `%s'." (buffer-name buf))
captured-messages))
(should (string-match "foo bla" (buffer-string)))))
(should (string-match "foo bla" (buffer-string))))
;; Stop autorevert, in order to cleanup descriptor.
(auto-revert-mode -1))
;; The environment shall be cleaned up.
(file-notify--test-cleanup-p))