1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-26 07:33:47 +00:00

* autorevert.el (auto-revert-notify-add-watch): fix handler installation

Fixes: bug#20000
This commit is contained in:
Filipp Gunbin 2015-03-04 19:35:42 +03:00
parent 6c0a602fb8
commit 5599661ead
2 changed files with 35 additions and 28 deletions

View 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)

View 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))
(if (or (string-match auto-revert-notify-exclude-dir-regexp
(expand-file-name default-directory))
(file-symlink-p (or buffer-file-name default-directory)))
(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))))
(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