]> git.eshelyaron.com Git - emacs.git/commitdiff
dired-goto-file fix for some `ls -b' escapes.
authorGlenn Morris <rgm@gnu.org>
Wed, 25 Jan 2012 08:20:24 +0000 (00:20 -0800)
committerGlenn Morris <rgm@gnu.org>
Wed, 25 Jan 2012 08:20:24 +0000 (00:20 -0800)
* lisp/dired.el (dired-goto-file):
Handle some of the more common characters that `ls -b' escapes.

Fixes: debbugs:10596
lisp/ChangeLog
lisp/dired.el

index e1038b8907201f7172e0a4524d59d5479c1a7389..6a47a9f0ece90909a5e0e866f9f85083d0345dca 100644 (file)
@@ -4,6 +4,9 @@
 
 2012-01-25  Glenn Morris  <rgm@gnu.org>
 
+       * dired.el (dired-goto-file): Handle some of the more common
+       characters that `ls -b' escapes.  (Bug#10596)
+
        * progmodes/compile.el (compilation-next-error-function):
        Respect compilation-first-column in the "*compilation*" buffer.
        * progmodes/grep.el (grep-first-column): New variable.  (Bug#10594)
index 57f67ca7c8c2fccf88009b4b422234678d64c20f..bb38d32785db4e9e0cc91fd05e07ec4dd3d4fe85 100644 (file)
@@ -2640,6 +2640,20 @@ instead of `dired-actual-switches'."
                  (replace-regexp-in-string "\^m" "\\^m" base nil t))
            (setq search-string
                  (replace-regexp-in-string "\\\\" "\\\\" search-string nil t))
+           (and (dired-switches-escape-p dired-actual-switches)
+                (string-match "[ \t\n]" search-string)
+                ;; FIXME to fix this for all possible file names
+                ;; (embedded control characters etc), we need to
+                ;; escape everything that `ls -b' does.
+                (setq search-string
+                      (replace-regexp-in-string " " "\\ "
+                                                search-string nil t)
+                      search-string
+                      (replace-regexp-in-string "\t" "\\t"
+                                                search-string nil t)
+                      search-string
+                      (replace-regexp-in-string "\n" "\\n"
+                                                search-string nil t)))
            (while (and (not found)
                        ;; filenames are preceded by SPC, this makes
                        ;; the search faster (e.g. for the filename "-"!).