+2013-01-17 Michael Albinus <michael.albinus@gmx.de>
+
+ * 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 <monnier@iro.umontreal.ca>
* emacs-lisp/trace.el (trace--read-args): Use a closure and an honest
: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:
'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)
(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)))))