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

#+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 via email to