summaryrefslogtreecommitdiff
path: root/lisp/autorevert.el
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2013-01-17 10:06:47 +0100
committerMichael Albinus <michael.albinus@gmx.de>2013-01-17 10:06:47 +0100
commit68a08a32e3979396d53fc5da371d928b9c7df881 (patch)
treedf4d594b3eff9fd1ae614b0de686a1e13cc71a34 /lisp/autorevert.el
parent468afbaceaeb045f69b1a47aa1550a2556cd7dfd (diff)
downloademacs-68a08a32e3979396d53fc5da371d928b9c7df881.tar.gz
emacs-68a08a32e3979396d53fc5da371d928b9c7df881.tar.bz2
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'.
Diffstat (limited to 'lisp/autorevert.el')
-rw-r--r--lisp/autorevert.el23
1 files changed, 13 insertions, 10 deletions
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."
: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 @@ will use an up-to-date value of `auto-revert-interval'"
'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 @@ will use an up-to-date value of `auto-revert-interval'"
(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)))))