aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2013-01-17 10:06:47 +0100
committerMichael Albinus2013-01-17 10:06:47 +0100
commit68a08a32e3979396d53fc5da371d928b9c7df881 (patch)
treedf4d594b3eff9fd1ae614b0de686a1e13cc71a34
parent468afbaceaeb045f69b1a47aa1550a2556cd7dfd (diff)
downloademacs-68a08a32e3979396d53fc5da371d928b9c7df881.tar.gz
emacs-68a08a32e3979396d53fc5da371d928b9c7df881.zip
* 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'.
-rw-r--r--lisp/ChangeLog10
-rw-r--r--lisp/autorevert.el23
2 files changed, 23 insertions, 10 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 676ce21ff14..a8924318676 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
12013-01-17 Michael Albinus <michael.albinus@gmx.de>
2
3 * autorevert.el (auto-revert-use-notify): In the :set function, do
4 not modify `kill-buffer-hook'.
5 (auto-revert-notify-rm-watch): Remove
6 `auto-revert-notify-rm-watch' from `kill-buffer-hook'.
7 (auto-revert-notify-add-watch): Do not call
8 `auto-revert-notify-rm-watch', but add it to a buffer local
9 `kill-buffer-hook'.
10
12013-01-16 Stefan Monnier <monnier@iro.umontreal.ca> 112013-01-16 Stefan Monnier <monnier@iro.umontreal.ca>
2 12
3 * emacs-lisp/trace.el (trace--read-args): Use a closure and an honest 13 * emacs-lisp/trace.el (trace--read-args): Use a closure and an honest
diff --git a/lisp/autorevert.el b/lisp/autorevert.el
index c9180482cd9..1ee1db01657 100644
--- a/lisp/autorevert.el
+++ b/lisp/autorevert.el
@@ -273,13 +273,12 @@ through Custom only."
273 :type 'boolean 273 :type 'boolean
274 :set (lambda (variable value) 274 :set (lambda (variable value)
275 (set-default variable (and auto-revert-notify-enabled value)) 275 (set-default variable (and auto-revert-notify-enabled value))
276 (if (symbol-value variable) 276 (unless (symbol-value variable)
277 (add-hook 'kill-buffer-hook 'auto-revert-notify-rm-watch)
278 (remove-hook 'kill-buffer-hook 'auto-revert-notify-rm-watch)
279 (when auto-revert-notify-enabled 277 (when auto-revert-notify-enabled
280 (dolist (buf (buffer-list)) 278 (dolist (buf (buffer-list))
281 (with-current-buffer buf 279 (with-current-buffer buf
282 (auto-revert-notify-rm-watch)))))) 280 (when (symbol-value 'auto-revert-notify-watch-descriptor)
281 (auto-revert-notify-rm-watch)))))))
283 :version "24.4") 282 :version "24.4")
284 283
285;; Internal variables: 284;; Internal variables:
@@ -472,14 +471,15 @@ will use an up-to-date value of `auto-revert-interval'"
472 'inotify-rm-watch 'w32notify-rm-watch) 471 'inotify-rm-watch 'w32notify-rm-watch)
473 auto-revert-notify-watch-descriptor)) 472 auto-revert-notify-watch-descriptor))
474 (remhash auto-revert-notify-watch-descriptor 473 (remhash auto-revert-notify-watch-descriptor
475 auto-revert-notify-watch-descriptor-hash-list)) 474 auto-revert-notify-watch-descriptor-hash-list)
475 (remove-hook 'kill-buffer-hook 'auto-revert-notify-rm-watch))
476 (setq auto-revert-notify-watch-descriptor nil 476 (setq auto-revert-notify-watch-descriptor nil
477 auto-revert-notify-modified-p nil)) 477 auto-revert-notify-modified-p nil))
478 478
479(defun auto-revert-notify-add-watch () 479(defun auto-revert-notify-add-watch ()
480 "Enable file watch for current buffer's associated file." 480 "Enable file watch for current buffer's associated file."
481 (when (and buffer-file-name auto-revert-use-notify) 481 (when (and buffer-file-name auto-revert-use-notify
482 (auto-revert-notify-rm-watch) 482 (not auto-revert-notify-watch-descriptor))
483 (let ((func (if (fboundp 'inotify-add-watch) 483 (let ((func (if (fboundp 'inotify-add-watch)
484 'inotify-add-watch 'w32notify-add-watch)) 484 'inotify-add-watch 'w32notify-add-watch))
485 (aspect (if (fboundp 'inotify-add-watch) 485 (aspect (if (fboundp 'inotify-add-watch)
@@ -489,9 +489,12 @@ will use an up-to-date value of `auto-revert-interval'"
489 (funcall 489 (funcall
490 func buffer-file-name aspect 'auto-revert-notify-handler))) 490 func buffer-file-name aspect 'auto-revert-notify-handler)))
491 (if auto-revert-notify-watch-descriptor 491 (if auto-revert-notify-watch-descriptor
492 (puthash auto-revert-notify-watch-descriptor 492 (progn
493 (current-buffer) 493 (puthash auto-revert-notify-watch-descriptor
494 auto-revert-notify-watch-descriptor-hash-list) 494 (current-buffer)
495 auto-revert-notify-watch-descriptor-hash-list)
496 (add-hook (make-local-variable 'kill-buffer-hook)
497 'auto-revert-notify-rm-watch))
495 ;; Fallback to file checks. 498 ;; Fallback to file checks.
496 (set (make-local-variable 'auto-revert-use-notify) nil))))) 499 (set (make-local-variable 'auto-revert-use-notify) nil)))))
497 500