]> git.eshelyaron.com Git - emacs.git/commitdiff
Finish changes in autorevert from commit 530bb2dc68
authorMichael Albinus <michael.albinus@gmx.de>
Mon, 22 Jan 2018 08:12:16 +0000 (09:12 +0100)
committerMichael Albinus <michael.albinus@gmx.de>
Mon, 22 Jan 2018 08:12:16 +0000 (09:12 +0100)
* 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.

lisp/autorevert.el
test/lisp/filenotify-tests.el

index da8942664b7f63f96cf4e3aef9d3eb3eb9988eef..cf145e0ee389a04afd0b79528b3727d73bb6ec95 100644 (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)))))
 
 
index 8745fdc9e50929d2d2cdd44a636513cbdc129a32..f2feef6132b994deeeac788f8e9eb12536091fbc 100644 (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))