diff options
author | Stefan Monnier <[email protected]> | 2008-04-07 16:29:54 +0000 |
---|---|---|
committer | Stefan Monnier <[email protected]> | 2008-04-07 16:29:54 +0000 |
commit | 9f2bd2e7c9e990b48a07be71ef47327f6cc9ba25 (patch) | |
tree | 6174f2ee11efb211b8b5cc5e7026064376df195a /lisp/subr.el | |
parent | e66d87717a06df5804e002cfe9863cb228a17660 (diff) |
(combine-and-quote-strings): Also quote strings that contain the separator.
Diffstat (limited to 'lisp/subr.el')
-rw-r--r-- | lisp/subr.el | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index 94ee316f9f..eee5908641 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -2987,10 +2987,11 @@ Modifies the match data; use `save-match-data' if necessary." 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))) |