# HG changeset patch # User Richard M. Stallman # Date 772792576 0 # Node ID 6511fd7aaea453f89c4bd4972bec3bf8c2247c7c # Parent 48c81a052cead088ee2356978f444f797dc4c917 (dired-readin): Record the directory's modtime. (dired-internal-noselect): Offer to revert if dir has changed. diff -r 48c81a052cea -r 6511fd7aaea4 lisp/dired.el --- a/lisp/dired.el Tue Jun 28 05:15:44 1994 +0000 +++ b/lisp/dired.el Tue Jun 28 08:36:16 1994 +0000 @@ -398,7 +398,16 @@ (set-buffer buffer) (if (not new-buffer-p) ; existing buffer ... (if switches ; ... but new switches - (dired-sort-other switches)) ; this calls dired-revert + (dired-sort-other switches) ; this calls dired-revert + ;; If directory has changed on disk, offer to revert. + (if (let ((attributes (file-attributes dirname)) + (modtime (visited-file-modtime))) + (or (not (eq (car attributes) t)) + (and (= (car (nth 5 attributes)) (car modtime)) + (= (nth 1 (nth 5 attributes)) (cdr modtime))))) + nil + (if (yes-or-no-p "Directory has changed on disk; update the buffer? ") + (dired-revert)))) ;; Else a new buffer (setq default-directory (abbreviate-file-name @@ -482,6 +491,9 @@ ;; dired-build-subdir-alist will call dired-clear-alist first (set (make-local-variable 'dired-subdir-alist) nil) (dired-build-subdir-alist) + (let ((attributes (file-attributes dirname))) + (if (eq (car attributes) t) + (set-visited-file-modtime (nth 5 attributes)))) (set-buffer-modified-p nil)))) ;; Subroutines of dired-readin