Mercurial > emacs
diff lisp/subr.el @ 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 | 310118b32104 |
children | 2d29453eb5e6 |
line wrap: on
line diff
--- 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)))