emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Christine Köhn" <christine@chark.eu>
To: emacs-orgmode@gnu.org
Subject: Bug: Double quotes in tables and arguments
Date: Fri, 05 Feb 2021 13:51:38 +0100	[thread overview]
Message-ID: <87r1lu7k4l.fsf@chark.eu> (raw)

[-- Attachment #1: Type: text/plain, Size: 1255 bytes --]

Hi,

I'm working with tokenized texts in org-mode tables including single
characters such as double quotes. When trying to read a cell with an
(unpaired) double quote at the beginning, the cell cannot be read ("End
of file during parsing"). I've looked a bit into this (see attached
file). At first, I thought it's a mere documentation issue: Double
quotes probably have a special meaning. The documentation of
org-bable-read (ob-core.el) does not mention a double quote as special
character:

> "Convert the string value of CELL to a number if appropriate.
> Otherwise if CELL looks like lisp (meaning it starts with a
> \"(\", \"\\='\", \"\\=`\" or a \"[\") then read and evaluate it as
> lisp, otherwise return it unmodified as a string.  Optional
> argument INHIBIT-LISP-EVAL inhibits lisp evaluation for
> situations in which is it not appropriate."

This is how cells with double quotes at the beginning are read:

> ((eq (string-to-char cell) ?\") (read cell))

I don't know why double quotes are handled as special characters and I
did not find any documentation on it.

This issue also exists when caching results from code blocks: If a
result starts with an (unpaired) double quote and it is cached, it
cannot be read anymore.

Best,
Christine


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: quote_mwe.org --]
[-- Type: text/x-org, Size: 986 bytes --]

#+NAME: print
#+begin_src emacs-lisp :var data=""
(print data)
#+end_src

Double quotes are preserved as long as there is no double quote as
first character:
#+NAME: ex1
| a"     |

Sourrounding double quotes are stripped:
#+NAME: ex2
| "a" |

#+CALL: print(data=ex2)

#+RESULTS:
| a |

This is unexpected:
#+NAME: ex2b
| "this_stays"this_has_to_go |

#+CALL: print(data=ex2b)

#+RESULTS:
| this_stays |

(Unpaired) double quote at beginning results in "End of file during
parsing":
#+NAME: ex3
| " |

#+CALL: print(data=ex3)

Passing an argument with (unpaired) double quote as first character to
code blocks works...
#+NAME: ex-code1
#+begin_src emacs-lisp
'("\"")
#+end_src

#+CALL: print(data=ex-code1)

#+RESULTS:
| " |

... as long as it's not from a cached result.
#+NAME: ex-code3
#+begin_src emacs-lisp :cache yes
'("\"")
#+end_src

#+RESULTS[f8bc0a680e2f0b8e579b262a13747cef1522cd72]: ex-code3
| " |

This results in "End of file during parsing":
#+CALL: print(data=ex-code3)

                 reply	other threads:[~2021-02-05 12:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=87r1lu7k4l.fsf@chark.eu \
    --to=christine@chark.eu \
    --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).