changeset 1170:54a44b2b9591

entered into RCS
author Richard M. Stallman <rms@gnu.org>
date Sat, 19 Sep 1992 19:40:38 +0000
parents a40b54fcb2ff
children 5c942f6b2d63
files lisp/dired-aux.el lisp/dired.el
diffstat 2 files changed, 18 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/dired-aux.el	Sat Sep 19 19:21:09 1992 +0000
+++ b/lisp/dired-aux.el	Sat Sep 19 19:40:38 1992 +0000
@@ -478,12 +478,13 @@
   ;; Return the name of the compressed or uncompressed file.
   ;; Rerurn nil if no change in files.
   (let (handler (handlers file-name-handler-alist))
-    (while (and (consp handlers) (null handler))
-      (if (and (consp (car handlers))
-	       (stringp (car (car handlers)))
-	       (string-match (car (car handlers)) file))
-	  (setq handler (cdr (car handlers))))
-      (setq handlers (cdr handlers)))
+    (save-match-data
+      (while (and (consp handlers) (null handler))
+	(if (and (consp (car handlers))
+		 (stringp (car (car handlers)))
+		 (string-match (car (car handlers)) file))
+	    (setq handler (cdr (car handlers))))
+	(setq handlers (cdr handlers))))
     (cond (handler
 	   (funcall handler 'dired-compress-file file))
 	  ((file-symlink-p file)
--- a/lisp/dired.el	Sat Sep 19 19:21:09 1992 +0000
+++ b/lisp/dired.el	Sat Sep 19 19:40:38 1992 +0000
@@ -187,7 +187,8 @@
 (defvar dired-subdir-alist nil
   "Association list of subdirectories and their buffer positions.
 Each subdirectory has an element: (DIRNAME . STARTMARKER).
-The order of elements is the reverse of the order in the buffer.")
+The order of elements is the reverse of the order in the buffer.
+In simple cases, this list contains one element.")
 
 (defvar dired-subdir-regexp "^. \\([^ \n\r]+\\)\\(:\\)[\n\r]"
   "Regexp matching a maybe hidden subdirectory line in `ls -lR' output.
@@ -851,7 +852,8 @@
   (let* ((dir (dired-current-directory))
 	 (up (file-name-directory (directory-file-name dir))))
     (or (dired-goto-file (directory-file-name dir))
-	(and dired-subdir-alist
+	;; Only try dired-goto-subdir if buffer has more than one dir.
+	(and (cdr dired-subdir-alist)
 	     (dired-goto-subdir up))
 	(progn
 	  (dired up)
@@ -868,7 +870,8 @@
 otherwise, display it in another buffer."
   (interactive)
   (if (file-directory-p (dired-get-filename))
-      (or (and dired-subdir-alist (dired-goto-subdir (dired-get-filename)))
+      (or (and (cdr dired-subdir-alist)
+	       (dired-goto-subdir (dired-get-filename)))
 	  (dired (dired-get-filename)))
     (view-file (dired-get-filename))))
 
@@ -1225,7 +1228,7 @@
       ;; without really calling it if we don't have any subdirs.
       (if (if (string= dir default-directory)
 	      (goto-char (point-min))
-	    (and dired-subdir-alist 
+	    (and (cdr dired-subdir-alist)
 		 (dired-goto-subdir dir)))
 	  (let ((base (file-name-nondirectory file))
 		(boundary (dired-subdir-max)))
@@ -1286,7 +1289,7 @@
 
 (defun dired-subdir-max ()
   (save-excursion
-    (if (or (null dired-subdir-alist) (not (dired-next-subdir 1 t t)))
+    (if (or (null (cdr dired-subdir-alist)) (not (dired-next-subdir 1 t t)))
 	(point-max)
       (point))))
 
@@ -1373,7 +1376,8 @@
 ;; This is a separate function for the sake of dired-x.el.
 (defun dired-clean-up-after-deletion (fn)
   ;; Clean up after a deleted file or directory FN.
-  (save-excursion (and (dired-goto-subdir fn)
+  (save-excursion (and (cdr dired-subdir-alist)
+		       (dired-goto-subdir fn)
 		       (dired-kill-subdir))))
 
 ;; Confirmation
@@ -1576,7 +1580,7 @@
 and \\[dired-unmark] on a subdir to remove the marks in
 this subdir."
   (interactive "P")
-  (if (and dired-subdir-alist (dired-get-subdir))
+  (if (and (cdr dired-subdir-alist) (dired-get-subdir))
       (save-excursion (dired-mark-subdir-files))
     (let (buffer-read-only)
       (dired-repeat-over-lines