diff options
author | Chong Yidong <cyd@stupidchicken.com> | 2009-04-02 22:16:17 +0000 |
---|---|---|
committer | Chong Yidong <cyd@stupidchicken.com> | 2009-04-02 22:16:17 +0000 |
commit | 1be9bd1e9de318c28a6024f3fb9189f7c81eb160 (patch) | |
tree | a72579f0cad0d360a40377c3f4badddaadccb4da /lisp/dired.el | |
parent | 96fe38a86776bba63590abf82602252ec473853e (diff) | |
download | emacs-1be9bd1e9de318c28a6024f3fb9189f7c81eb160.tar.gz |
* dired.el (dired-get-filename): Always pass filename through
`read' to ensure unquoting is performed (Bug#2862).
Diffstat (limited to 'lisp/dired.el')
-rw-r--r-- | lisp/dired.el | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lisp/dired.el b/lisp/dired.el index fc13c7281c1..087a05f3de4 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -1950,11 +1950,14 @@ Otherwise, an error occurs in these cases." ;; 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. - (while (string-match - "\\(?:[^\\]\\|\\`\\)\\(\\\\[0-7][0-7][0-7]\\)" file) - (setq file (replace-match - (read (concat "\"" (match-string 1 file) "\"")) - nil t file 1))) + ;; This code was written using `read' to unquote, because + ;; it's faster than substituting \007 (4 chars) -> ^G (1 + ;; char) etc. in a lisp loop. Unfortunately, this decision + ;; has necessitated hacks such as dealing with filenames + ;; with quotation marks in their names. + (while (string-match "\\(?:[^\\]\\|\\`\\)\\(\"\\)" file) + (setq file (replace-match "\\\"" nil t file 1))) + (setq file (read (concat "\"" file "\""))) ;; The above `read' will return a unibyte string if FILE ;; contains eight-bit-control/graphic characters. (if (and enable-multibyte-characters |