changeset 1130:e18597ff3c95

*** empty log message ***
author Richard M. Stallman <rms@gnu.org>
date Sun, 13 Sep 1992 20:40:20 +0000
parents 6f1d3e86c4fd
children 853d0d4c61fb
files lisp/dired.el lisp/subr.el
diffstat 2 files changed, 27 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/dired.el	Sun Sep 13 19:05:13 1992 +0000
+++ b/lisp/dired.el	Sun Sep 13 20:40:20 1992 +0000
@@ -495,6 +495,7 @@
     (setq mark-alist;; only after dired-remember-hidden since this unhides:
 	  (dired-remember-marks (point-min) (point-max)))
     ;; treat top level dir extra (it may contain wildcards)
+    (dired-uncache dired-directory)
     (dired-readin dired-directory (current-buffer))
     (let ((dired-after-readin-hook nil))
       ;; don't run that hook for each subdir...
@@ -571,8 +572,23 @@
 		old-subdir-alist (cdr old-subdir-alist)
 		dir (car elt))
 	  (condition-case ()
-	      (dired-insert-subdir dir)
+	      (progn
+		(dired-uncache dir)
+		(dired-insert-subdir dir))
 	    (error nil))))))
+
+;; Remove directory DIR from any directory cache.
+(defun dired-uncache (dir)
+  (let (handler (handlers file-name-handler-alist))
+    (save-match-data
+     (while (and (consp handlers) (null handler))
+       (if (and (consp (car handlers))
+		(stringp (car (car handlers)))
+		(string-match (car (car handlers)) dir))
+	   (setq handler (cdr (car handlers))))
+       (setq handlers (cdr handlers))))
+    (if handler
+	(funcall handler 'dired-uncache dir))))
 
 ;; dired mode key bindings and initialization
 
@@ -854,7 +870,7 @@
   (if (file-directory-p (dired-get-filename))
       (or (and dired-subdir-alist (dired-goto-subdir (dired-get-filename)))
 	  (dired (dired-get-filename)))
-    (view-file (file-name-sans-versions (dired-get-filename) t))))
+    (view-file (dired-get-filename))))
 
 (defun dired-find-file-other-window ()
   "In dired, visit this file or directory in another window."
--- a/lisp/subr.el	Sun Sep 13 19:05:13 1992 +0000
+++ b/lisp/subr.el	Sun Sep 13 20:40:20 1992 +0000
@@ -146,6 +146,15 @@
 	  (setcdr (car keymap) newdef))
       (setq keymap (cdr keymap)))))
 
+(defmacro save-match-data (&rest body)
+  "Execute the BODY forms, restoring the global value of the match data."
+  (let ((original (make-symbol "match-data")))
+    (list
+     'let (list (list original '(match-data)))
+     (list 'unwind-protect
+           (cons 'progn body)
+           (list 'store-match-data original)))))
+
 ;; Avoids useless byte-compilation.
 ;; In the future, would be better to fix byte compiler
 ;; not to really compile in cases like this,