aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1994-06-28 08:36:16 +0000
committerRichard M. Stallman1994-06-28 08:36:16 +0000
commitfa562dd5e14ed55d584bffe2c99a92acb122ada4 (patch)
tree0ef4f1bc799eaca8709e7d458c924b8164fd73c7
parent79e6ae333e560fa055ecf1261f3e658fe16a862f (diff)
downloademacs-fa562dd5e14ed55d584bffe2c99a92acb122ada4.tar.gz
emacs-fa562dd5e14ed55d584bffe2c99a92acb122ada4.zip
(dired-readin): Record the directory's modtime.
(dired-internal-noselect): Offer to revert if dir has changed.
-rw-r--r--lisp/dired.el14
1 files changed, 13 insertions, 1 deletions
diff --git a/lisp/dired.el b/lisp/dired.el
index e81a34f073e..3fb87804342 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -398,7 +398,16 @@ If DIRNAME is already in a dired buffer, that buffer is used without refresh."
398 (set-buffer buffer) 398 (set-buffer buffer)
399 (if (not new-buffer-p) ; existing buffer ... 399 (if (not new-buffer-p) ; existing buffer ...
400 (if switches ; ... but new switches 400 (if switches ; ... but new switches
401 (dired-sort-other switches)) ; this calls dired-revert 401 (dired-sort-other switches) ; this calls dired-revert
402 ;; If directory has changed on disk, offer to revert.
403 (if (let ((attributes (file-attributes dirname))
404 (modtime (visited-file-modtime)))
405 (or (not (eq (car attributes) t))
406 (and (= (car (nth 5 attributes)) (car modtime))
407 (= (nth 1 (nth 5 attributes)) (cdr modtime)))))
408 nil
409 (if (yes-or-no-p "Directory has changed on disk; update the buffer? ")
410 (dired-revert))))
402 ;; Else a new buffer 411 ;; Else a new buffer
403 (setq default-directory 412 (setq default-directory
404 (abbreviate-file-name 413 (abbreviate-file-name
@@ -482,6 +491,9 @@ If DIRNAME is already in a dired buffer, that buffer is used without refresh."
482 ;; dired-build-subdir-alist will call dired-clear-alist first 491 ;; dired-build-subdir-alist will call dired-clear-alist first
483 (set (make-local-variable 'dired-subdir-alist) nil) 492 (set (make-local-variable 'dired-subdir-alist) nil)
484 (dired-build-subdir-alist) 493 (dired-build-subdir-alist)
494 (let ((attributes (file-attributes dirname)))
495 (if (eq (car attributes) t)
496 (set-visited-file-modtime (nth 5 attributes))))
485 (set-buffer-modified-p nil)))) 497 (set-buffer-modified-p nil))))
486 498
487;; Subroutines of dired-readin 499;; Subroutines of dired-readin