]> code.delx.au - gnu-emacs/blobdiff - lisp/autorevert.el
Update copyright year to 2015
[gnu-emacs] / lisp / autorevert.el
index 65526f07e1b31caf5a2bef5e4a1d0f2024a4f941..8c8c6174c473a50849cec0d8601ab169ffa43d15 100644 (file)
@@ -1,6 +1,6 @@
 ;;; autorevert.el --- revert buffers when files on disk change
 
-;; Copyright (C) 1997-1999, 2001-2013 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1999, 2001-2015 Free Software Foundation, Inc.
 
 ;; Author: Anders Lindgren <andersl@andersl.com>
 ;; Keywords: convenience
@@ -504,13 +504,15 @@ will use an up-to-date value of `auto-revert-interval'"
 
 (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
@@ -587,8 +589,8 @@ This is an internal function used by Auto-Revert Mode."
           ;; the values.
           (remote-file-name-inhibit-cache t)
           (revert
-           (or (and buffer-file-name
-                    (or auto-revert-remote-files
+           (if buffer-file-name
+               (and (or auto-revert-remote-files
                         (not (file-remote-p buffer-file-name)))
                     (or (not auto-revert-use-notify)
                         auto-revert-notify-modified-p)
@@ -601,11 +603,11 @@ This is an internal function used by Auto-Revert Mode."
                       (funcall (or buffer-stale-function
                                     #'buffer-stale--default-function)
                                 t)))
-               (and (or auto-revert-mode
-                        global-auto-revert-non-file-buffers)
-                    (funcall (or buffer-stale-function
-                                  #'buffer-stale--default-function)
-                              t))))
+             (and (or auto-revert-mode
+                      global-auto-revert-non-file-buffers)
+                  (funcall (or buffer-stale-function
+                               #'buffer-stale--default-function)
+                           t))))
           eob eoblist)
       (setq auto-revert-notify-modified-p nil)
       (when revert
@@ -670,7 +672,7 @@ Should `auto-revert-mode' be active in some buffers, those buffers
 are checked.
 
 Non-file buffers that have a custom `revert-buffer-function' and
-`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.
@@ -688,8 +690,7 @@ the timer when no buffers need to be checked."
     (let ((bufs (if global-auto-revert-mode
                    (buffer-list)
                  auto-revert-buffer-list))
-         (remaining ())
-         (new ()))
+         remaining new)
       ;; Partition `bufs' into two halves depending on whether or not
       ;; the buffers are in `auto-revert-remaining-buffers'.  The two
       ;; halves are then re-joined with the "remaining" buffers at the