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: Fri, 3 May 2024 00:56:43 +0700
User-agent: Mozilla Thunderbird

On 01/05/2024 19:19, Ihor Radchenko wrote:
And replacing the call to org-babel-string-read with org-babel-read does not
break any tests...

Since

005e68294 2009-06-11 17:04:42 -0700 Eric Schulte: making progress bringing org-babel-R.el into the new evaluation schema

`org-babel-string-read' has been stripping quotes, but `org-string-read' got this feature later in

60a8ba556 2011-03-02 07:55:39 -0700 Eric Schulte: ob: read string variable values wrapped in double quotes, removing the quotes

So now outer quotes are stripped twice.

(org-babel-string-read "\"\"1\"\"")
"1"

(org-babel-read "\"\"1\"\"" t)
"\"\"1\"\""

There are still more subtle differences between these functions:

(org-babel-string-read "\"1\" 2 \"3\"")
"1\" 2 \"3"

(org-babel-read "\"1\" 2 \"3\"" t)
"\"1\" 2 \"3\""

What I do not like in `org-babel-read' is false positive for escaped quote when actually backslash is escaped:

(org-babel-read "\"1\\\\\" 2 \\\\\"3\"" t)
"1\\"

(org-babel-read "\"1\\\\|\" 2 \\\\|\"3\"" t)
"\"1\\\\|\" 2 \\\\|\"3\""

Test suite is far from being exhaustive.




reply via email to

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