# HG changeset patch # User Stefan Monnier # Date 1207585794 0 # Node ID f0bcbdcf1d54a9b8a32fe10f04ec8b884fb4aa2b # Parent 217fd7a2dc383652839f6eb98fdc4a5f4e9b044c (combine-and-quote-strings): Also quote strings that contain the separator. diff -r 217fd7a2dc38 -r f0bcbdcf1d54 lisp/ChangeLog --- 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 + * 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 diff -r 217fd7a2dc38 -r f0bcbdcf1d54 lisp/subr.el --- 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)))