emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r106930: dired-goto-file fix for some


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r106930: dired-goto-file fix for some `ls -b' escapes.
Date: Wed, 25 Jan 2012 00:20:24 -0800
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 106930
fixes bug(s): http://debbugs.gnu.org/10596
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Wed 2012-01-25 00:20:24 -0800
message:
  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.
modified:
  lisp/ChangeLog
  lisp/dired.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-01-25 05:48:11 +0000
+++ b/lisp/ChangeLog    2012-01-25 08:20:24 +0000
@@ -4,6 +4,9 @@
 
 2012-01-25  Glenn Morris  <address@hidden>
 
+       * 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)

=== modified file 'lisp/dired.el'
--- a/lisp/dired.el     2012-01-19 07:21:25 +0000
+++ b/lisp/dired.el     2012-01-25 08:20:24 +0000
@@ -2640,6 +2640,20 @@
                  (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 "-"!).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]