[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 5599661: * autorevert.el (auto-revert-notify-add-wa
From: |
Filipp Gunbin |
Subject: |
[Emacs-diffs] master 5599661: * autorevert.el (auto-revert-notify-add-watch): fix handler installation |
Date: |
Wed, 04 Mar 2015 16:39:27 +0000 |
branch: master
commit 5599661ead86228d7fea5e8dbf3d3a4e59f3d4fd
Author: Filipp Gunbin <address@hidden>
Commit: Filipp Gunbin <address@hidden>
* autorevert.el (auto-revert-notify-add-watch): fix handler installation
Fixes: bug#20000
---
lisp/ChangeLog | 6 +++++
lisp/autorevert.el | 59 ++++++++++++++++++++++++++-------------------------
2 files changed, 36 insertions(+), 29 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 5c04663..08dcca2 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2015-03-04 Filipp Gunbin <address@hidden>
+
+ * autorevert.el (auto-revert-notify-add-watch): fix handler
+ installation
+ Fixes: bug#20000
+
2015-03-04 RĂ¼diger Sonderfeld <address@hidden>
* net/eww.el (eww-search-prefix, eww-open-file, eww-search-words)
diff --git a/lisp/autorevert.el b/lisp/autorevert.el
index 6489a3e..357916c 100644
--- a/lisp/autorevert.el
+++ b/lisp/autorevert.el
@@ -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))
-
- (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))
+ (if (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))))
+ (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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 5599661: * autorevert.el (auto-revert-notify-add-watch): fix handler installation,
Filipp Gunbin <=