[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Orgmode] org-babel-read should have option NOT to interpret as elis
Re: [Orgmode] org-babel-read should have option NOT to interpret as elisp
Sun, 27 Feb 2011 08:51:37 -0700
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)
Vladimir Alexiev <address@hidden> writes:
> I keep perl regexps in a table, and some of them start with "(".
> I'd like these to be left alone (returned unmodified as a string).
> (info "(org)var") doesn't mention special processing of table cells,
> but the doc of org-babel-read says:
> 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 it as lisp, otherwise return it
> unmodified as a string.
> So it seems to me that this special behavior of org-babel-read
> should be documented in info, and controllable by a user option.
When passing values directly through header arguments the solution would
be to wrap the string in double-quotes so that it is interpreted as a
literal string, e.g.,
#+begin_src perl :var it="(+ 1 1)" :results output
printf "passed in %s", $it
: passed in (+ 1 1)
However I do agree that this would be onerous to have to wrap every cell
of a table in double quotes...
I'm attaching a patch which inhibits the lisp evaluation of values read
from tables and lists. This should solve your issue above. I'm not
directly applying this patch, because it would be a breaking change for
anyone who is currently relying on the ability to fill a table or list
with to-be-evaluated emacs-lisp statements. If anyone is in that
situation please respond to this email in the next couple of days,
otherwise I am leaning towards applying this patch to the main
Best -- Eric
p.s. this patch can be applied with the "git am" command.
Description: Text Data