comparison lisp/dired.el @ 8073:6511fd7aaea4

(dired-readin): Record the directory's modtime. (dired-internal-noselect): Offer to revert if dir has changed.
author Richard M. Stallman <rms@gnu.org>
date Tue, 28 Jun 1994 08:36:16 +0000
parents db1785b91d03
children bc8c9c72e3bf
comparison
equal deleted inserted replaced
8072:48c81a052cea 8073:6511fd7aaea4
396 ;; kill-all-local-variables any longer. 396 ;; kill-all-local-variables any longer.
397 (setq buffer (create-file-buffer (directory-file-name dirname))))) 397 (setq buffer (create-file-buffer (directory-file-name dirname)))))
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
405 (if (file-directory-p dirname) 414 (if (file-directory-p dirname)
406 dirname 415 dirname
480 (message "Reading directory %s...done" dirname) 489 (message "Reading directory %s...done" dirname)
481 ;; Must first make alist buffer local and set it to nil because 490 ;; Must first make alist buffer local and set it to nil because
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
488 500
489 (defun dired-readin-insert (dir-or-list) 501 (defun dired-readin-insert (dir-or-list)