Chapter 14: Working with source code
The following options are mutually exclusive and specify what type of results the code block
will return. By default, results are inserted according to the type as speciﬁed above.
raw The results are interpreted as raw Org mode code and are inserted directly into
the buﬀer. If the results look like a table they will be aligned as such by Org mode.
E.g., :results value raw.
org The results are will be enclosed in a BEGIN_SRC org block. They are not comma-
escaped by default but they will be if you hit TAB in the block and/or if you export the
ﬁle. E.g., :results value org.
html Results are assumed to be HTML and will be enclosed in a BEGIN_HTML block.
E.g., :results value html.
latex Results assumed to be LAT
Xand are enclosed in a BEGIN_LaTeX block. E.g.,
:results value latex.
code Result are assumed to be parsable code and are enclosed in a code block. E.g.,
:results value code.
pp The result is converted to pretty-printed code and is enclosed in a code block. This
option currently supports Emacs Lisp, Python, and Ruby. E.g., :results value pp.
drawer The result is wrapped in a RESULTS drawer. This can be useful for inserting
raw or org syntax results in such a way that their extent is known and they can be
automatically removed or replaced.
The following results options indicate what happens with the results once they are collected.
silent The results will be echoed in the minibuﬀer but will not be inserted into the
Org mode buﬀer. E.g., :results output silent.
replace The default value. Any existing results will be removed, and the new re-
sults will be inserted into the Org mode buﬀer in their place. E.g., :results output
append If there are pre-existing results of the code block then the new results will be
appended to the existing results. Otherwise the new results will be inserted as with
prepend If there are pre-existing results of the code block then the new results will be
prepended to the existing results. Otherwise the new results will be inserted as with
The header argument :file is used to specify an external ﬁle in which to save code block
results. After code block evaluation an Org mode style [[file:]] link (see Section4.1
[Link format], page 38)totheﬁlewillbeinsertedintotheOrgmodebuﬀer.Somelanguages
including R, gnuplot, dot, and ditaa provide special handling of the :file header argument
automatically wrapping the code block body in the boilerplate code required to save output
to the speciﬁed ﬁle. This is often useful for saving graphical output of a code block to the