emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Max Nikulin <manikulin@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Importing "quoted" strings in `org-babel-import-elisp-from-file'
Date: Fri, 3 May 2024 00:56:43 +0700	[thread overview]
Message-ID: <v10k4s$et9$1@ciao.gmane.io> (raw)
In-Reply-To: <87jzkdenc8.fsf@localhost>

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	other threads:[~2024-05-02 17:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-28 13:15 [BUG] ob-shell: results missing leading quotes Matt
2024-04-29 11:58 ` Ihor Radchenko
2024-05-01 10:48   ` Max Nikulin
2024-05-01 12:19     ` Importing "quoted" strings in `org-babel-import-elisp-from-file' (was: [BUG] ob-shell: results missing leading quotes) Ihor Radchenko
2024-05-02 17:56       ` Max Nikulin [this message]
2024-05-03 12:06         ` Importing "quoted" strings in `org-babel-import-elisp-from-file' Ihor Radchenko
2024-05-04  7:53           ` Max Nikulin
2024-05-04  8:03             ` Ihor Radchenko
2024-05-04 11:17               ` Max Nikulin
2024-05-04 11:51                 ` Ihor Radchenko
2024-05-04 14:55                   ` Max Nikulin
2024-05-04 19:34                     ` Ihor Radchenko
2024-05-04 15:58                   ` Max Nikulin
2024-05-04 19:35                     ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='v10k4s$et9$1@ciao.gmane.io' \
    --to=manikulin@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).