diff options
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/autorevert.el | 59 |
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 @@ | |||
| 1 | 2015-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 | |||
| 1 | 2015-03-04 RĂ¼diger Sonderfeld <ruediger@c-plusplus.net> | 7 | 2015-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 |