Files
dotdenote/assets/docker/notes/20240405T140000--org-babel-literate-programming__org_babel.org
andros 9ddd118a49 Redesign UI with flat retro Emacs aesthetic
Replace standard iOS components with a terminal-inspired design:
monospaced typography throughout, flat square borders, Emacs-style
modeline header, filetag keyword format (:kw1:kw2:), and custom
flat form replacing the iOS Form component. Set Emacs as default
theme. Replace non-Emacs demo notes with Emacs ecosystem content
and rename screenshots.
2026-06-17 12:54:41 +02:00

1.0 KiB

Org Babel: Literate Programming

What is Org Babel

Org Babel lets you embed executable code blocks inside org files and run them directly. Results are captured inline below the block.

Supported languages

Python, Emacs Lisp, Shell, SQL, R, Julia, Haskell, and dozens more.

(org-babel-do-load-languages
 'org-babel-load-languages
 '((python . t)
   (shell . t)
   (sql . t)
   (emacs-lisp . t)))

Example: Python block

words = ["denote", "emacs", "org", "babel"]
for w in words:
    print(w.upper())

Example: Shell

ls ~/notes/ | head -5

Tangle: exporting code to files

The :tangle header exports the code block to a file on disk.

(setq inhibit-startup-message t)
(menu-bar-mode -1)
(tool-bar-mode -1)

Running C-c C-v t writes the block to the target file.