bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#7711: Patch for bug #7687


From: Stefan Monnier
Subject: bug#7711: Patch for bug #7687
Date: Fri, 21 Jan 2011 13:07:30 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

forcemerge 7687 7711
close 7711
thanks

> the empty string. The new version of shell-quote-argument
> treats newlines specially. They are quoted with single
> quotes.

Thanks.  I've installed a slightly different patch (took the opportunity
to simplify the code by using replace-regexp-in-string) that implements
your idea.


        Stefan


=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog      2011-01-21 05:04:45 +0000
+++ lisp/ChangeLog      2011-01-21 18:04:16 +0000
@@ -1,3 +1,8 @@
+2011-01-21  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * subr.el (shell-quote-argument): Properly quote \n (bug#7687).
+       Suggested by Flo <sensorflo@gmail.com>.
+
 2011-01-21  Glenn Morris  <rgm@gnu.org>
 
        * progmodes/compile.el (compilation-error-regexp-alist):

=== modified file 'lisp/subr.el'
--- lisp/subr.el        2011-01-15 02:32:19 +0000
+++ lisp/subr.el        2011-01-21 18:04:45 +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]