]> git.eshelyaron.com Git - emacs.git/commitdiff
* dired.el (dired-get-filename): Always pass filename through
authorChong Yidong <cyd@stupidchicken.com>
Thu, 2 Apr 2009 22:16:17 +0000 (22:16 +0000)
committerChong Yidong <cyd@stupidchicken.com>
Thu, 2 Apr 2009 22:16:17 +0000 (22:16 +0000)
`read' to ensure unquoting is performed (Bug#2862).

lisp/ChangeLog
lisp/dired.el

index 874de7777fc3081cb468575bbd5d8cc2669a43d8..f02ca12b5e6480bc0541daf1b1c7c7c1bd4f346b 100644 (file)
@@ -1,3 +1,8 @@
+2009-04-02  Chong Yidong  <cyd@stupidchicken.com>
+
+       * dired.el (dired-get-filename): Always pass filename through
+       `read' to ensure unquoting is performed (Bug#2862).
+
 2009-04-02  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * doc-view.el (doc-view-mode): Don't give up if the file doesn't exist.
index fc13c7281c113e3823a3eddc1014d7676cc01141..087a05f3de42b4180e12a6969dcc9b896c2da559 100644 (file)
@@ -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