From: Glenn Morris Date: Wed, 25 Jan 2012 08:20:24 +0000 (-0800) Subject: dired-goto-file fix for some `ls -b' escapes. X-Git-Tag: emacs-pretest-24.0.93~71 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=40047858c6c270c3a7eb842abcbea042bb2781fd;p=emacs.git dired-goto-file fix for some `ls -b' escapes. * lisp/dired.el (dired-goto-file): Handle some of the more common characters that `ls -b' escapes. Fixes: debbugs:10596 --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e1038b89072..6a47a9f0ece 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -4,6 +4,9 @@ 2012-01-25 Glenn Morris + * 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) diff --git a/lisp/dired.el b/lisp/dired.el index 57f67ca7c8c..bb38d32785d 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -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 "-"!).