changeset 93825:f0bcbdcf1d54

(combine-and-quote-strings): Also quote strings that contain the separator.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 07 Apr 2008 16:29:54 +0000
parents 217fd7a2dc38
children 76b4fbf19628
files lisp/ChangeLog lisp/subr.el
diffstat 2 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Mon Apr 07 16:03:31 2008 +0000
+++ b/lisp/ChangeLog	Mon Apr 07 16:29:54 2008 +0000
@@ -10,6 +10,9 @@
 
 2008-04-07  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+	* subr.el (combine-and-quote-strings): Also quote strings that contain
+	the separator.
+
 	* pcvs-util.el (cvs-map): Avoid recursion :-(
 
 2008-04-07  Glenn Morris  <rgm@gnu.org>
--- a/lisp/subr.el	Mon Apr 07 16:03:31 2008 +0000
+++ b/lisp/subr.el	Mon Apr 07 16:29:54 2008 +0000
@@ -2987,10 +2987,11 @@
 This tries to quote the strings to avoid ambiguity such that
   (split-string-and-unquote (combine-and-quote-strings strs)) == strs
 Only some SEPARATORs will work properly."
-  (let ((sep (or separator " ")))
+  (let* ((sep (or separator " "))
+         (re (concat "[\\\"]" "\\|" (regexp-quote sep))))
     (mapconcat
      (lambda (str)
-       (if (string-match "[\\\"]" str)
+       (if (string-match re str)
 	   (concat "\"" (replace-regexp-in-string "[\\\"]" "\\\\\\&" str) "\"")
 	 str))
      strings sep)))