On 04/05/2024 15:03, Ihor Radchenko wrote:
Max Nikulin writes:
I have no idea if "other\n\"string\"\nlines" may be passed
`org-babel-read', but it is not discarded by the current regexp:
"^[[:space:]]*\"\\(.*\\)\"[[:space:]]*$"
I do not see why we should limit things to single-line strings.
Quotes are not stripped:
(org-babel-read "\"abc\nsdf\"" t)
"\"abc
sdf\""
(org-babel-read "(\n\"abc\"\n" t)
progn: End of file during parsing
My conclusion that the current regexp may give both false positives and
false negatives. `read` errors are not handled, but likely it is a
result of wrong guarding regexp.
1. read is faster
I would not argue since I have no benchmark. My expectation was that
replace is mostly no-op, so original string is returned while using
`read' requires some overhead for a temporary buffer.
2. read is less maintenance - we can rely upon robust implementation
provided by Emacs itself instead of doing something custom, with
potential bugs.