aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Gunbin2015-03-04 19:35:42 +0300
committerFilipp Gunbin2015-03-04 19:39:24 +0300
commit5599661ead86228d7fea5e8dbf3d3a4e59f3d4fd (patch)
treec5164ab92520cbc65a2fec7723b23f02f426fe6f
parent6c0a602fb8f0ac54d05e8aa13fdb1d478370c123 (diff)
downloademacs-5599661ead86228d7fea5e8dbf3d3a4e59f3d4fd.tar.gz
emacs-5599661ead86228d7fea5e8dbf3d3a4e59f3d4fd.zip
* autorevert.el (auto-revert-notify-add-watch): fix handler installation
Fixes: bug#20000
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/autorevert.el59
2 files changed, 36 insertions, 29 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 5c04663f9e8..08dcca2fbe8 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12015-03-04 Filipp Gunbin <fgunbin@fastmail.fm>
2
3 * autorevert.el (auto-revert-notify-add-watch): fix handler
4 installation
5 Fixes: bug#20000
6
12015-03-04 RĂ¼diger Sonderfeld <ruediger@c-plusplus.net> 72015-03-04 RĂ¼diger Sonderfeld <ruediger@c-plusplus.net>
2 8
3 * net/eww.el (eww-search-prefix, eww-open-file, eww-search-words) 9 * net/eww.el (eww-search-prefix, eww-open-file, eww-search-words)
diff --git a/lisp/autorevert.el b/lisp/autorevert.el
index 6489a3e04c2..357916c6b4d 100644
--- a/lisp/autorevert.el
+++ b/lisp/autorevert.el
@@ -503,36 +503,37 @@ will use an up-to-date value of `auto-revert-interval'"
503 "Enable file notification for current buffer's associated file." 503 "Enable file notification for current buffer's associated file."
504 ;; We can assume that `buffer-file-name' and 504 ;; We can assume that `buffer-file-name' and
505 ;; `auto-revert-use-notify' are non-nil. 505 ;; `auto-revert-use-notify' are non-nil.
506 (when (or (string-match auto-revert-notify-exclude-dir-regexp 506 (if (or (string-match auto-revert-notify-exclude-dir-regexp
507 (expand-file-name default-directory)) 507 (expand-file-name default-directory))
508 (file-symlink-p (or buffer-file-name default-directory))) 508 (file-symlink-p (or buffer-file-name default-directory)))
509 ;; Fallback to file checks. 509
510 (set (make-local-variable 'auto-revert-use-notify) nil))
511
512 (when (not auto-revert-notify-watch-descriptor)
513 (setq auto-revert-notify-watch-descriptor
514 (ignore-errors
515 (if buffer-file-name
516 (file-notify-add-watch
517 (expand-file-name buffer-file-name default-directory)
518 '(change attribute-change)
519 'auto-revert-notify-handler)
520 (file-notify-add-watch
521 (expand-file-name default-directory)
522 '(change)
523 'auto-revert-notify-handler))))
524 (if auto-revert-notify-watch-descriptor
525 (progn
526 (puthash
527 auto-revert-notify-watch-descriptor
528 (cons (current-buffer)
529 (gethash auto-revert-notify-watch-descriptor
530 auto-revert-notify-watch-descriptor-hash-list))
531 auto-revert-notify-watch-descriptor-hash-list)
532 (add-hook (make-local-variable 'kill-buffer-hook)
533 'auto-revert-notify-rm-watch))
534 ;; Fallback to file checks. 510 ;; Fallback to file checks.
535 (set (make-local-variable 'auto-revert-use-notify) nil)))) 511 (set (make-local-variable 'auto-revert-use-notify) nil)
512
513 (when (not auto-revert-notify-watch-descriptor)
514 (setq auto-revert-notify-watch-descriptor
515 (ignore-errors
516 (if buffer-file-name
517 (file-notify-add-watch
518 (expand-file-name buffer-file-name default-directory)
519 '(change attribute-change)
520 'auto-revert-notify-handler)
521 (file-notify-add-watch
522 (expand-file-name default-directory)
523 '(change)
524 'auto-revert-notify-handler))))
525 (if auto-revert-notify-watch-descriptor
526 (progn
527 (puthash
528 auto-revert-notify-watch-descriptor
529 (cons (current-buffer)
530 (gethash auto-revert-notify-watch-descriptor
531 auto-revert-notify-watch-descriptor-hash-list))
532 auto-revert-notify-watch-descriptor-hash-list)
533 (add-hook (make-local-variable 'kill-buffer-hook)
534 'auto-revert-notify-rm-watch))
535 ;; Fallback to file checks.
536 (set (make-local-variable 'auto-revert-use-notify) nil)))))
536 537
537;; If we have file notifications, we want to update the auto-revert buffers 538;; If we have file notifications, we want to update the auto-revert buffers
538;; immediately when a notification occurs. Since file updates can happen very 539;; immediately when a notification occurs. Since file updates can happen very