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 14:53:39 +0700
User-agent: Mozilla Thunderbird

On 03/05/2024 19:06, Ihor Radchenko wrote:
Max Nikulin writes:

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\\"
Fixed, on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=2028bb15c
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:]]*$"

Is there a reason why it is necessary to call `read' twice on the same content? From my point of view, result of first call may be returned.
Does `read' have other role than unescaping backslash-protected 
characters? Likely it can be done by `replace-regexp-in-string', see the 
attachment. I have tried regexp on the following string:
   (let ((cases '(("" . nil)
               ("\"" . nil)
               ("\"\"" . t)
               ("\"\\\"" . nil)
               ("\"\\\\\"" . t)
               ("a" . nil)
               ("\"a\"" . t)
               ("\\\"a\\\"" . nil)
               ("\\\"a\\\\\"" . nil)
               ("\"a\\\"\"" . t)
               ("\"aa\\\"bb\"" . t)
               (" \"aa( bb\"" . t))))

Attachment: patch-ob-read-quoted-string.diff
Description: Text Data


reply via email to

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