This is the official manual for the latest Org-mode release.
C-c ' for editing the current code block. It opens a new major-mode edit buffer containing the body of the source code block, ready for any edits. C-c ' again to close the buffer and return to the Org buffer.
<C-x C-s> saves the buffer and updates the contents of the Org buffer.
org-edit-src-auto-save-idle-delay to save the base buffer after
a certain idle delay time.
org-edit-src-turn-on-auto-save to auto-save this buffer into a
separate file using
C-c ' to close the major-mode buffer and return back to the Org buffer.
While editing the source code in the major-mode, the
minor mode remains active. It provides these customization variables as
described below. For even more variables, look in the customization
<lang>is the language identifier from code block's header line, then the edit buffer uses that major-mode. Use this variable to arbitrarily map language identifiers to major modes.
nil. Source code is indented. This indentation applies during export or tangling, and depending on the context, may alter leading spaces and tabs. When non-
nil, source code is aligned with the leftmost column. No lines are modified during export or tangling—very useful for white-space sensitive languages, such as Python.
nil, Org returns to the edit buffer without further prompts. The default prompts for a confirmation.
org-src-fontify-natively to non-
nil to turn on native code
fontification in the Org buffer. Fontification of source code blocks
can give visual separation of text and code on the display page. To further
customize the appearance of
org-block for specific languages,
org-src-block-faces. The following example shades the
background of regular blocks, and colors source blocks only for Python and
(require 'color) (set-face-attribute 'org-block nil :background (color-darken-name (face-attribute 'default :background) 3)) (setq org-src-block-faces '(("emacs-lisp" (:background "#EEE2FF")) ("python" (:background "#E5FFB8"))))