# HG changeset patch # User Chong Yidong # Date 1220649379 0 # Node ID cb25381fabcc421bf06ae34e5f4364832b375864 # Parent 752eb2a81b8272543b205c90e125d9da1545dd7c (dired-get-filename): Rewrite octal escape character processor (bug#885). diff -r 752eb2a81b82 -r cb25381fabcc lisp/dired.el --- a/lisp/dired.el Fri Sep 05 21:16:01 2008 +0000 +++ b/lisp/dired.el Fri Sep 05 21:16:19 2008 +0000 @@ -1915,17 +1915,11 @@ ;; Get rid of the mouse-face property that file names have. (set-text-properties 0 (length file) nil file) ;; Unquote names quoted by ls or by dired-insert-directory. - ;; Using read to unquote is much faster than substituting - ;; \007 (4 chars) -> ^G (1 char) etc. in a lisp loop. - (setq file - (read - (concat "\"" - ;; Some ls -b don't escape quotes, argh! - ;; This is not needed for GNU ls, though. - (or (dired-string-replace-match - "\\([^\\]\\|\\`\\)\"" file "\\1\\\\\"" nil t) - file) - "\""))) + (while (string-match + "\\(?:[^\\]\\|\\`\\)\\(\\\\[0-7][0-7][0-7]\\)" file) + (setq file (replace-match + (read (concat "\"" (match-string 1 file) "\"")) + nil t file 1))) ;; The above `read' will return a unibyte string if FILE ;; contains eight-bit-control/graphic characters. (if (and enable-multibyte-characters