Function: org-babel-read
org-babel-read is a byte-compiled function defined in ob-core.el.gz.
Signature
(org-babel-read CELL &optional INHIBIT-LISP-EVAL)
Documentation
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.
Source Code
;; Defined in /usr/src/emacs/lisp/org/ob-core.el.gz
(defun org-babel-read (cell &optional inhibit-lisp-eval)
"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."
(cond ((not (org-string-nw-p cell)) cell)
((org-babel--string-to-number cell))
((and (not inhibit-lisp-eval)
(or (memq (string-to-char cell) '(?\( ?' ?` ?\[))
(string= cell "*this*")))
;; FIXME: Arbitrary code evaluation.
(eval (read cell) t))
((let (read-val)
(and (string-match-p
(rx bos (0+ (any space ?\n))
?\" (0+ anychar) ?\"
(0+ (any space ?\n)) eos)
cell)
;; CELL is a single string
(with-temp-buffer
(insert cell)
(goto-char 1)
(when (setq read-val
(ignore-errors
(read (current-buffer))))
(skip-chars-forward "[:space:]")
(eobp)))
read-val)))
(t (org-no-properties cell))))