Code blocks can be evaluated1 and the results of evaluation optionally placed in the
Org mode buffer. The results of evaluation are placed following a line that
begins by default with
#+RESULTS and optionally a cache identifier
and/or the name of the evaluated code block. The default value of
#+RESULTS can be changed with the customizable variable
By default, the evaluation facility is only enabled for Lisp code blocks
emacs-lisp. However, source code blocks in many languages
can be evaluated within Org mode (see Languages for a list of supported
languages and Structure of code blocks for information on the syntax
used to define a code block).
There are a number of ways to evaluate code blocks. The simplest is to press
C-c C-c or C-c C-v e with the point on a code block2. This will call the
org-babel-execute-src-block function to evaluate the block and insert
its results into the Org mode buffer.
It is also possible to evaluate named code blocks from anywhere in an Org
mode buffer or an Org mode table. Live code blocks located in the current
Org mode buffer or in the “Library of Babel” (see Library of Babel)
can be executed. Named code blocks can be executed with a separate
#+CALL: line or inline within a block of text.
The syntax of the
#+CALL: line is
#+CALL: <name>(<arguments>) #+CALL: <name>[<inside header arguments>](<arguments>) <end header arguments>
The syntax for inline evaluation of named code blocks is
... call_<name>(<arguments>) ... ... call_<name>[<inside header arguments>](<arguments>)[<end header arguments>] ...
#+CALL:line that passes the number four to a code block named
double, which declares the header argument
:var n=2, would be written as
<inside header arguments>
[:results output]will collect the results of everything printed to
STDOUTduring execution of the code block.
<end header arguments>
:results htmlwill insert the results of the call line evaluation in the Org buffer, wrapped in a
For more examples of passing header arguments to
#+CALL: lines see
Header arguments in function calls.
 Whenever code is evaluated there is a potential for that code to do harm. Org mode provides safeguards to ensure that code is only evaluated after explicit confirmation from the user. For information on these safeguards (and on how to disable them) see Code evaluation security.
org-babel-no-eval-on-ctrl-c-ctrl-c can be used to remove code
evaluation from the C-c C-c key binding.