aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2008-04-07 16:29:54 +0000
committerStefan Monnier2008-04-07 16:29:54 +0000
commit9f2bd2e7c9e990b48a07be71ef47327f6cc9ba25 (patch)
tree6174f2ee11efb211b8b5cc5e7026064376df195a
parente66d87717a06df5804e002cfe9863cb228a17660 (diff)
downloademacs-9f2bd2e7c9e990b48a07be71ef47327f6cc9ba25.tar.gz
emacs-9f2bd2e7c9e990b48a07be71ef47327f6cc9ba25.zip
(combine-and-quote-strings): Also quote strings that contain the separator.
-rw-r--r--lisp/ChangeLog3
-rw-r--r--lisp/subr.el5
2 files changed, 6 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e7a74037af8..7518a3a71d3 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -10,6 +10,9 @@
10 10
112008-04-07 Stefan Monnier <monnier@iro.umontreal.ca> 112008-04-07 Stefan Monnier <monnier@iro.umontreal.ca>
12 12
13 * subr.el (combine-and-quote-strings): Also quote strings that contain
14 the separator.
15
13 * pcvs-util.el (cvs-map): Avoid recursion :-( 16 * pcvs-util.el (cvs-map): Avoid recursion :-(
14 17
152008-04-07 Glenn Morris <rgm@gnu.org> 182008-04-07 Glenn Morris <rgm@gnu.org>
diff --git a/lisp/subr.el b/lisp/subr.el
index 94ee316f9f4..eee59086419 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2987,10 +2987,11 @@ Modifies the match data; use `save-match-data' if necessary."
2987This tries to quote the strings to avoid ambiguity such that 2987This tries to quote the strings to avoid ambiguity such that
2988 (split-string-and-unquote (combine-and-quote-strings strs)) == strs 2988 (split-string-and-unquote (combine-and-quote-strings strs)) == strs
2989Only some SEPARATORs will work properly." 2989Only some SEPARATORs will work properly."
2990 (let ((sep (or separator " "))) 2990 (let* ((sep (or separator " "))
2991 (re (concat "[\\\"]" "\\|" (regexp-quote sep))))
2991 (mapconcat 2992 (mapconcat
2992 (lambda (str) 2993 (lambda (str)
2993 (if (string-match "[\\\"]" str) 2994 (if (string-match re str)
2994 (concat "\"" (replace-regexp-in-string "[\\\"]" "\\\\\\&" str) "\"") 2995 (concat "\"" (replace-regexp-in-string "[\\\"]" "\\\\\\&" str) "\"")
2995 str)) 2996 str))
2996 strings sep))) 2997 strings sep)))