emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r111542: * autorevert.el (auto-revert


From: Michael Albinus
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111542: * autorevert.el (auto-revert-use-notify): In the :set function, do
Date: Thu, 17 Jan 2013 10:06:47 +0100
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111542
committer: Michael Albinus <address@hidden
branch nick: trunk
timestamp: Thu 2013-01-17 10:06:47 +0100
message:
  * autorevert.el (auto-revert-use-notify): In the :set function, do
  not modify `kill-buffer-hook'.
  (auto-revert-notify-rm-watch): Remove
  `auto-revert-notify-rm-watch' from `kill-buffer-hook'.
  (auto-revert-notify-add-watch): Do not call
  `auto-revert-notify-rm-watch', but add it to a buffer local
  `kill-buffer-hook'.
modified:
  lisp/ChangeLog
  lisp/autorevert.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-01-16 19:06:15 +0000
+++ b/lisp/ChangeLog    2013-01-17 09:06:47 +0000
@@ -1,3 +1,13 @@
+2013-01-17  Michael Albinus  <address@hidden>
+
+       * autorevert.el (auto-revert-use-notify): In the :set function, do
+       not modify `kill-buffer-hook'.
+       (auto-revert-notify-rm-watch): Remove
+       `auto-revert-notify-rm-watch' from `kill-buffer-hook'.
+       (auto-revert-notify-add-watch): Do not call
+       `auto-revert-notify-rm-watch', but add it to a buffer local
+       `kill-buffer-hook'.
+
 2013-01-16  Stefan Monnier  <address@hidden>
 
        * emacs-lisp/trace.el (trace--read-args): Use a closure and an honest

=== modified file 'lisp/autorevert.el'
--- a/lisp/autorevert.el        2013-01-12 19:24:27 +0000
+++ b/lisp/autorevert.el        2013-01-17 09:06:47 +0000
@@ -273,13 +273,12 @@
   :type 'boolean
   :set (lambda (variable value)
         (set-default variable (and auto-revert-notify-enabled value))
-        (if (symbol-value variable)
-            (add-hook 'kill-buffer-hook 'auto-revert-notify-rm-watch)
-          (remove-hook 'kill-buffer-hook 'auto-revert-notify-rm-watch)
+        (unless (symbol-value variable)
           (when auto-revert-notify-enabled
             (dolist (buf (buffer-list))
               (with-current-buffer buf
-                (auto-revert-notify-rm-watch))))))
+                (when (symbol-value 'auto-revert-notify-watch-descriptor)
+                  (auto-revert-notify-rm-watch)))))))
   :version "24.4")
 
 ;; Internal variables:
@@ -472,14 +471,15 @@
                   'inotify-rm-watch 'w32notify-rm-watch)
               auto-revert-notify-watch-descriptor))
     (remhash auto-revert-notify-watch-descriptor
-            auto-revert-notify-watch-descriptor-hash-list))
+            auto-revert-notify-watch-descriptor-hash-list)
+    (remove-hook 'kill-buffer-hook 'auto-revert-notify-rm-watch))
   (setq auto-revert-notify-watch-descriptor nil
        auto-revert-notify-modified-p nil))
 
 (defun auto-revert-notify-add-watch ()
   "Enable file watch for current buffer's associated file."
-  (when (and buffer-file-name auto-revert-use-notify)
-    (auto-revert-notify-rm-watch)
+  (when (and buffer-file-name auto-revert-use-notify
+            (not auto-revert-notify-watch-descriptor))
     (let ((func (if (fboundp 'inotify-add-watch)
                    'inotify-add-watch 'w32notify-add-watch))
          (aspect (if (fboundp 'inotify-add-watch)
@@ -489,9 +489,12 @@
              (funcall
               func buffer-file-name aspect 'auto-revert-notify-handler)))
       (if auto-revert-notify-watch-descriptor
-         (puthash auto-revert-notify-watch-descriptor
-                  (current-buffer)
-                  auto-revert-notify-watch-descriptor-hash-list)
+         (progn
+           (puthash auto-revert-notify-watch-descriptor
+                    (current-buffer)
+                    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)))))
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]