emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: Double quotes in tables and arguments
@ 2021-02-05 12:51 Christine Köhn
  0 siblings, 0 replies; only message in thread
From: Christine Köhn @ 2021-02-05 12:51 UTC (permalink / raw)
  To: emacs-orgmode

[-- 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)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-02-05 12:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-05 12:51 Bug: Double quotes in tables and arguments Christine Köhn

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).