changeset 48986:5f0ef23b7e51

(dired-goto-file): Handle \ and ^M quoted by backslash. Fix error message.
author Richard M. Stallman <rms@gnu.org>
date Sat, 28 Dec 2002 21:26:46 +0000
parents dae8bb57e633
children 0bf251ecfd1a
files lisp/dired.el
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/dired.el	Sat Dec 28 21:23:58 2002 +0000
+++ b/lisp/dired.el	Sat Dec 28 21:26:46 2002 +0000
@@ -1957,7 +1957,7 @@
   (setq file (directory-file-name file)) ; does no harm if no directory
   (let (found case-fold-search dir)
     (setq dir (or (file-name-directory file)
-		  (error "Need absolute pathname for %s" file)))
+		  (error "File name `%s' is not absolute" file)))
     (save-excursion
       ;; The hair here is to get the result of dired-goto-subdir
       ;; without really calling it if we don't have any subdirs.
@@ -1966,11 +1966,17 @@
 	    (and (cdr dired-subdir-alist)
 		 (dired-goto-subdir dir)))
 	  (let ((base (file-name-nondirectory file))
+		search-string
 		(boundary (dired-subdir-max)))
+	    (setq search-string
+		  (replace-regexp-in-string "\^m" "\\^m" base nil t))
+	    (setq search-string
+		  (replace-regexp-in-string "\\\\" "\\\\" search-string nil t))
 	    (while (and (not found)
 			;; filenames are preceded by SPC, this makes
 			;; the search faster (e.g. for the filename "-"!).
- 			(search-forward (concat " " base) boundary 'move))
+ 			(search-forward (concat " " search-string)
+					boundary 'move))
 	      ;; Match could have BASE just as initial substring or
 	      ;; or in permission bits or date or
 	      ;; not be a proper filename at all: