emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/emacs-23 r100388: * lisp/subr.el (shell-quo


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-23 r100388: * lisp/subr.el (shell-quote-argument): Properly quote \n.
Date: Fri, 21 Jan 2011 13:07:41 -0500
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 100388
committer: Stefan Monnier <address@hidden>
branch nick: emacs-23
timestamp: Fri 2011-01-21 13:07:41 -0500
message:
  * lisp/subr.el (shell-quote-argument): Properly quote \n.
  Suggested by Flo <address@hidden>.
modified:
  lisp/ChangeLog
  lisp/subr.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-01-21 05:04:45 +0000
+++ b/lisp/ChangeLog    2011-01-21 18:07:41 +0000
@@ -1,3 +1,8 @@
+2011-01-21  Stefan Monnier  <address@hidden>
+
+       * subr.el (shell-quote-argument): Properly quote \n (bug#7687).
+       Suggested by Flo <address@hidden>.
+
 2011-01-21  Glenn Morris  <address@hidden>
 
        * progmodes/compile.el (compilation-error-regexp-alist):

=== modified file 'lisp/subr.el'
--- a/lisp/subr.el      2011-01-15 02:32:19 +0000
+++ b/lisp/subr.el      2011-01-21 18:07:41 +0000
@@ -2426,13 +2426,8 @@
         "''"
       ;; Quote everything except POSIX filename characters.
       ;; This should be safe enough even for really weird shells.
-      (let ((result "") (start 0) end)
-        (while (string-match "[^-0-9a-zA-Z_./]" argument start)
-          (setq end (match-beginning 0)
-                result (concat result (substring argument start end)
-                               "\\" (substring argument end (1+ end)))
-                start (1+ end)))
-        (concat result (substring argument start))))))
+      (replace-regexp-in-string "\n" "'\n'"
+       (replace-regexp-in-string "[^-0-9a-zA-Z_./\n]" "\\\\\\&" argument)))))
 
 (defun string-or-null-p (object)
   "Return t if OBJECT is a string or nil.


reply via email to

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