mkd
mkd

Reputation: 37

Org babel print elisp variable

Using org, I'd like to execute Lisp code which prints the value of a variable into a results block. E.g. I'm trying to print the value of org-babel-default-header-args.

I've tried this:

#+BEGIN_SRC elisp :exports both
(print 'org-babel-default-header-args)
#+END_SRC


#+BEGIN_SRC elisp :exports both
(org-babel-default-header-args)
#+END_SRC

#+BEGIN_SRC elisp :exports both
(symbol-value 'org-babel-default-header-args)
#+END_SRC

The closest thing I've gotten to work is this:

#+BEGIN_SRC elisp :exports both
(describe-variable 'org-babel-default-header-args)
#+END_SRC

But that prints out some extra text. I'd like to literally just print the value of the variable.

Upvotes: 1

Views: 526

Answers (1)

NickD
NickD

Reputation: 6412

To print the value of a variable foo, use

(print foo)

without quoting it. Quote inhibits evaluation: that's exactly what you don't want to do here.

Upvotes: 2

Related Questions