From: Michael Albinus Date: Mon, 22 Jan 2018 08:12:16 +0000 (+0100) Subject: Finish changes in autorevert from commit 530bb2dc68 X-Git-Tag: emacs-27.0.90~5830 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d0fd9809d7574c67a181225fcc1c59afdbb1295c;p=emacs.git 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. --- diff --git a/lisp/autorevert.el b/lisp/autorevert.el index da8942664b7..cf145e0ee38 100644 --- a/lisp/autorevert.el +++ b/lisp/autorevert.el @@ -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))))) diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el index 8745fdc9e50..f2feef6132b 100644 --- a/test/lisp/filenotify-tests.el +++ b/test/lisp/filenotify-tests.el @@ -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))