According to fniessen's babel reference I should be able to set :eval yes
on a babel header line to make a source block evaluate without confirmation. However, this doesn't seem to work for me on Emacs 24.4 and Org 8.2.10. Is this capability only available in org version 8.3 and beyond? If not, what do I need to do to enable it?
2 Answers
According to the Org Mode Manual, :eval yes
is not recognized by org-mode
. (I also failed to find any uses of :eval yes
reading Org sources, both the 8.2.10 release and the master
branch.)
I opened an issue so we can get Fabrice Niessen's take on this.
On the other hand, one can customize org-confirm-babel-evaluate
. Its documentation states:
Confirm before evaluation. Require confirmation before interactively evaluating code blocks in Org-mode buffers. The default value of this variable is t, meaning confirmation is required for any code block evaluation. This variable can be set to nil to inhibit any future confirmation requests. This variable can also be set to a function which takes two arguments the language of the code block and the body of the code block. Such a function should then return a non-nil value if the user should be prompted for execution or nil if no prompt is required.
Warning: Disabling confirmation may result in accidental evaluation of potentially harmful code. It may be advisable remove code block execution from C-c C-c as further protection against accidental code block evaluation. The
org-babel-no-eval-on-ctrl-c-ctrl-c
variable can be used to remove code block execution from the C-c C-c keybinding.
For example, I want org-mode
to evaluate LaTeX and Maxima blocks without confirmation:
(defun ck/org-confirm-babel-evaluate (lang body)
(not (or (string= lang "latex") (string= lang "maxima"))))
(setq org-confirm-babel-evaluate 'ck/org-confirm-babel-evaluate)
-
Your above link to the manual is broken, and what's more, there are now multiple, inconsistent sources: this version of the manual at orgmode.org for version 9.6 still has the
:eval yes
bit, but the manual for 9.5 at gnu.org doesn't have that. Feb 26 at 13:45
Indeed, ":eval yes" is not an official value -- I wasn't aware of that.
Though, every value other than the listed official values does WELL function as an ":eval yes" (see ":eval foo").
#+PROPERTY: eval no
* Testing evaluation
#+begin_src emacs-lisp
(message "evaluated?")
#+end_src
#+begin_src emacs-lisp :eval yes
(message "evaluated as well?")
#+end_src
#+results:
: evaluated as well?
#+begin_src emacs-lisp :eval query
(message "evaluated after confirmation")
#+end_src
#+results:
: evaluated after confirmation
#+begin_src emacs-lisp :eval query-export
(message "evaluated -- but requires confirmation for export")
#+end_src
#+results:
: evaluated -- but requires confirmation for export
#+begin_src emacs-lisp :eval never
(message "never evaluated")
#+end_src
#+begin_src emacs-lisp :eval never-export
(message "never evaluated during export")
#+end_src
#+results:
: never evaluated during export
#+begin_src emacs-lisp :eval foo
(message "evaluated when misc value is given?")
#+end_src
#+results:
: evaluated when misc value is given?
Otherwise, how do you counter the property "eval no" in a subtree or on a code block?
-
2I've updated my refcard on GitHub. It should be correct now. Thanks for your feedback!– fniessenJan 9, 2015 at 23:00