;;; autorevert.el --- revert buffers when files on disk change
-;; Copyright (C) 1997-1999, 2001-2013 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1999, 2001-2014 Free Software Foundation, Inc.
;; Author: Anders Lindgren <andersl@andersl.com>
;; Keywords: convenience
(defun auto-revert-notify-add-watch ()
"Enable file notification for current buffer's associated file."
- (when (string-match auto-revert-notify-exclude-dir-regexp
- (expand-file-name default-directory))
+ ;; 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 buffer-file-name))
;; Fallback to file checks.
(set (make-local-variable 'auto-revert-use-notify) nil))
- (when (and buffer-file-name auto-revert-use-notify
- (not auto-revert-notify-watch-descriptor))
+ (when (not auto-revert-notify-watch-descriptor)
(setq auto-revert-notify-watch-descriptor
(ignore-errors
(file-notify-add-watch
are checked.
Non-file buffers that have a custom `revert-buffer-function' and
-a `buffer-stale-function' are reverted either when Auto-Revert
+`buffer-stale-function' are reverted either when Auto-Revert
Mode is active in that buffer, or when the variable
`global-auto-revert-non-file-buffers' is non-nil and Global
Auto-Revert Mode is active.