Am 22.03.2013 15:22, schrieb Nicolas Goaziou:
Actually the code I pasted is wrong, I meant:
(split-string
(replace-regexp-in-string
"\\(\\\\+\\)?\\(,\\)"
(lambda (str)
(let ((len (length (match-string 1 str))))
(if (evenp len) (concat (make-string (/ len 2) ?\\) "\000")
(concat (make-string (/ (1- len) 2) ?\\) ","))))
(org-matcĥ-string-no-properties 3) nil t)
"\000")
That is starting to make sense... :-)
You might want to use the (function (lambda ...)) form.
With the current implementation (and in your refactoring), it is
impossible to have '("a\,b").
Yes, you'd need a second form of quoting to properly support that. It's
also impossible to have leading or trailing whitespace, so I don't know
how important it is to support this edge case of "\,".
If consistency is a matter, a slightly different patch can require to
escape every backslash character. Though, I don't think it is necessary.
I'm not sure it is worth the trouble.
Regards,
--
Achim.
(on the road :-)