This is the official manual for the latest Org-mode release.
Unlike plain text, running code comes with risk. Each ‘src’ code block, in terms of risk, is equivalent to an executable file. Org therefore puts a few confirmation prompts by default. This is to alert the casual user from accidentally running untrusted code.
For users who do not run code blocks or write code regularly, Org's default settings should suffice. However, some users may want to tweak the prompts for fewer interruptions. To weigh the risks of automatic execution of code blocks, here are some details about code evaluation.
Org evaluates code in the following circumstances:
When
t, Org prompts the user for confirmation before executing each code block. Whennil, Org executes code blocks without prompting the user for confirmation. When this option is set to a custom function, Org invokes the function with these two arguments: the source code language and the body of the code block. The custom function must return either atornil, which determines if the user is prompted. Each source code language can be handled separately through this function argument.
For example, this function enables execution of ‘ditaa’ code +blocks without prompting:
(defun my-org-confirm-babel-evaluate (lang body)
(not (string= lang "ditaa"))) ; don't ask for ditaa
(setq org-confirm-babel-evaluate 'my-org-confirm-babel-evaluate)
shell and elisp linksFunction that prompts the user before executing a shell link.
Function that prompts the user before executing an Emacs Lisp link.