From 40047858c6c270c3a7eb842abcbea042bb2781fd Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 25 Jan 2012 00:20:24 -0800 Subject: [PATCH] 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 --- lisp/ChangeLog | 3 +++ lisp/dired.el | 14 ++++++++++++++ 2 files changed, 17 insertions(+) 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 "-"!). -- 2.39.2