summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/dired.el20
-rw-r--r--lisp/subr.el9
2 files changed, 27 insertions, 2 deletions
diff --git a/lisp/dired.el b/lisp/dired.el
index d4788e7cac6..02a4d53d681 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -495,6 +495,7 @@ If DIRNAME is already in a dired buffer, that buffer is used without refresh."
(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 @@ If DIRNAME is already in a dired buffer, that buffer is used without refresh."
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 @@ otherwise, display it in another buffer."
(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."
diff --git a/lisp/subr.el b/lisp/subr.el
index d50e5035ffe..486a217c766 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -146,6 +146,15 @@ perhaps they ought to be."
(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,