This is the official manual for the latest Org-mode release.
Use C-c ' to edit the current code block. This brings up a language
major-mode edit buffer containing the body of the code block. Manually
saving this buffer with <C-x C-s> will write the contents back to the Org
buffer. You can also set org-edit-src-auto-save-idle-delay
to save the
base buffer after some idle delay, or org-edit-src-turn-on-auto-save
to auto-save this buffer into a separate file using auto-save-mode
.
Use C-c ' again to exit.
The org-src-mode
minor mode will be active in the edit buffer. The
following variables can be used to configure the behavior of the edit
buffer. See also the customization group org-edit-structure
for
further configuration options.
org-src-lang-modes
<lang>-mode
exists, where
<lang>
is the language named in the header line of the code block,
then the edit buffer will be placed in that major-mode. This variable
can be used to map arbitrary language names to existing major modes.
org-src-window-setup
org-src-preserve-indentation
nil
, which means that when code blocks are
evaluated during export or tangled, they are re-inserted into the code block,
which may replace sequences of spaces with tab characters. When non-nil,
whitespace in code blocks will be preserved during export or tangling,
exactly as it appears. This variable is especially useful for tangling
languages such as Python, in which whitespace indentation in the output is
critical.
org-src-ask-before-returning-to-edit-buffer
nil
to switch without asking.
To turn on native code fontification in the Org buffer, configure the
variable org-src-fontify-natively
.