aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2002-12-28 21:26:46 +0000
committerRichard M. Stallman2002-12-28 21:26:46 +0000
commitf808da9ebbd556beb720c1b3ca977d2db3c9c751 (patch)
treea4ae1376bf8a091a7583364f6a6b9caed789fb99
parent4ad1689f62df07deb17f5682ba61139377081c4d (diff)
downloademacs-f808da9ebbd556beb720c1b3ca977d2db3c9c751.tar.gz
emacs-f808da9ebbd556beb720c1b3ca977d2db3c9c751.zip
(dired-goto-file): Handle \ and ^M quoted by backslash. Fix error message.
-rw-r--r--lisp/dired.el10
1 files changed, 8 insertions, 2 deletions
diff --git a/lisp/dired.el b/lisp/dired.el
index 11669400ad6..700d1e25634 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -1957,7 +1957,7 @@ instead of `dired-actual-switches'."
1957 (setq file (directory-file-name file)) ; does no harm if no directory 1957 (setq file (directory-file-name file)) ; does no harm if no directory
1958 (let (found case-fold-search dir) 1958 (let (found case-fold-search dir)
1959 (setq dir (or (file-name-directory file) 1959 (setq dir (or (file-name-directory file)
1960 (error "Need absolute pathname for %s" file))) 1960 (error "File name `%s' is not absolute" file)))
1961 (save-excursion 1961 (save-excursion
1962 ;; The hair here is to get the result of dired-goto-subdir 1962 ;; The hair here is to get the result of dired-goto-subdir
1963 ;; without really calling it if we don't have any subdirs. 1963 ;; without really calling it if we don't have any subdirs.
@@ -1966,11 +1966,17 @@ instead of `dired-actual-switches'."
1966 (and (cdr dired-subdir-alist) 1966 (and (cdr dired-subdir-alist)
1967 (dired-goto-subdir dir))) 1967 (dired-goto-subdir dir)))
1968 (let ((base (file-name-nondirectory file)) 1968 (let ((base (file-name-nondirectory file))
1969 search-string
1969 (boundary (dired-subdir-max))) 1970 (boundary (dired-subdir-max)))
1971 (setq search-string
1972 (replace-regexp-in-string "\^m" "\\^m" base nil t))
1973 (setq search-string
1974 (replace-regexp-in-string "\\\\" "\\\\" search-string nil t))
1970 (while (and (not found) 1975 (while (and (not found)
1971 ;; filenames are preceded by SPC, this makes 1976 ;; filenames are preceded by SPC, this makes
1972 ;; the search faster (e.g. for the filename "-"!). 1977 ;; the search faster (e.g. for the filename "-"!).
1973 (search-forward (concat " " base) boundary 'move)) 1978 (search-forward (concat " " search-string)
1979 boundary 'move))
1974 ;; Match could have BASE just as initial substring or 1980 ;; Match could have BASE just as initial substring or
1975 ;; or in permission bits or date or 1981 ;; or in permission bits or date or
1976 ;; not be a proper filename at all: 1982 ;; not be a proper filename at all: