]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve `dired-buffer-stale-p' for remote files
authorMichael Albinus <michael.albinus@gmx.de>
Mon, 14 May 2018 15:09:18 +0000 (17:09 +0200)
committerMichael Albinus <michael.albinus@gmx.de>
Mon, 14 May 2018 15:09:18 +0000 (17:09 +0200)
* lisp/dired.el (dired-buffer-stale-p): Check for ´file-remote-p'
only if `auto-revert-remote-files' is non-nil.

lisp/dired.el

index 1c283c5de3f83bf00979427fd480f874689141a9..41b46d463a25a8769df43e01086e4460d776ce0f 100644 (file)
@@ -850,14 +850,18 @@ If DIRNAME is already in a Dired buffer, that buffer is used without refresh."
             (not (eq (car attributes) t))
             (equal (nth 5 attributes) modtime)))))
 
+(defvar auto-revert-remote-files)
+
 (defun dired-buffer-stale-p (&optional noconfirm)
   "Return non-nil if current Dired buffer needs updating.
-If NOCONFIRM is non-nil, then this function always returns nil
-for a remote directory.  This feature is used by Auto Revert mode."
+If NOCONFIRM is non-nil, then this function returns nil for a
+remote directory, unless `auto-revert-remote-files' is non-nil.
+This feature is used by Auto Revert mode."
   (let ((dirname
         (if (consp dired-directory) (car dired-directory) dired-directory)))
     (and (stringp dirname)
-        (not (when noconfirm (file-remote-p dirname)))
+        (not (when noconfirm (and (not auto-revert-remote-files)
+                                   (file-remote-p dirname))))
         (file-readable-p dirname)
         ;; Do not auto-revert when the dired buffer can be currently
         ;; written by the user as in `wdired-mode'.