]> git.eshelyaron.com Git - emacs.git/commitdiff
* autorevert.el (auto-revert-notify-add-watch): fix handler installation
authorFilipp Gunbin <fgunbin@fastmail.fm>
Wed, 4 Mar 2015 16:35:42 +0000 (19:35 +0300)
committerFilipp Gunbin <fgunbin@fastmail.fm>
Wed, 4 Mar 2015 16:39:24 +0000 (19:39 +0300)
Fixes: bug#20000
lisp/ChangeLog
lisp/autorevert.el

index 5c04663f9e88bb46aa44022451357fc643a65909..08dcca2fbe82808c601651618c8f2775b8476a93 100644 (file)
@@ -1,3 +1,9 @@
+2015-03-04  Filipp Gunbin <fgunbin@fastmail.fm>
+
+       * autorevert.el (auto-revert-notify-add-watch): fix handler
+       installation
+       Fixes: bug#20000
+
 2015-03-04  RĂ¼diger Sonderfeld  <ruediger@c-plusplus.net>
 
        * net/eww.el (eww-search-prefix, eww-open-file, eww-search-words)
index 6489a3e04c284b13790dd8473f2fc4228aea491c..357916c6b4d7dcacb7431a618f1c3e713b96c6ec 100644 (file)
@@ -503,36 +503,37 @@ will use an up-to-date value of `auto-revert-interval'"
   "Enable file notification for current buffer's associated file."
   ;; We can assume that `buffer-file-name' and
   ;; `auto-revert-use-notify' are non-nil.
-  (when (or (string-match auto-revert-notify-exclude-dir-regexp
-                         (expand-file-name default-directory))
-           (file-symlink-p (or buffer-file-name default-directory)))
-    ;; Fallback to file checks.
-    (set (make-local-variable 'auto-revert-use-notify) nil))
-
-  (when (not auto-revert-notify-watch-descriptor)
-    (setq auto-revert-notify-watch-descriptor
-         (ignore-errors
-           (if buffer-file-name
-               (file-notify-add-watch
-                (expand-file-name buffer-file-name default-directory)
-                '(change attribute-change)
-                'auto-revert-notify-handler)
-             (file-notify-add-watch
-              (expand-file-name default-directory)
-              '(change)
-              'auto-revert-notify-handler))))
-    (if auto-revert-notify-watch-descriptor
-       (progn
-         (puthash
-          auto-revert-notify-watch-descriptor
-          (cons (current-buffer)
-                (gethash auto-revert-notify-watch-descriptor
-                         auto-revert-notify-watch-descriptor-hash-list))
-          auto-revert-notify-watch-descriptor-hash-list)
-         (add-hook (make-local-variable 'kill-buffer-hook)
-                   'auto-revert-notify-rm-watch))
+  (if (or (string-match auto-revert-notify-exclude-dir-regexp
+                       (expand-file-name default-directory))
+         (file-symlink-p (or buffer-file-name default-directory)))
+
       ;; Fallback to file checks.
-      (set (make-local-variable 'auto-revert-use-notify) nil))))
+      (set (make-local-variable 'auto-revert-use-notify) nil)
+
+    (when (not auto-revert-notify-watch-descriptor)
+      (setq auto-revert-notify-watch-descriptor
+           (ignore-errors
+             (if buffer-file-name
+                 (file-notify-add-watch
+                  (expand-file-name buffer-file-name default-directory)
+                  '(change attribute-change)
+                  'auto-revert-notify-handler)
+               (file-notify-add-watch
+                (expand-file-name default-directory)
+                '(change)
+                'auto-revert-notify-handler))))
+      (if auto-revert-notify-watch-descriptor
+         (progn
+           (puthash
+            auto-revert-notify-watch-descriptor
+            (cons (current-buffer)
+                  (gethash auto-revert-notify-watch-descriptor
+                           auto-revert-notify-watch-descriptor-hash-list))
+            auto-revert-notify-watch-descriptor-hash-list)
+           (add-hook (make-local-variable 'kill-buffer-hook)
+                     'auto-revert-notify-rm-watch))
+       ;; Fallback to file checks.
+       (set (make-local-variable 'auto-revert-use-notify) nil)))))
 
 ;; If we have file notifications, we want to update the auto-revert buffers
 ;; immediately when a notification occurs. Since file updates can happen very