emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Importing "quoted" strings in `org-babel-import-elisp-from-file'


From: Max Nikulin
Subject: Re: Importing "quoted" strings in `org-babel-import-elisp-from-file'
Date: Sat, 4 May 2024 18:17:22 +0700
User-agent: Mozilla Thunderbird

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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]