9ddd118a49
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.
1.0 KiB
1.0 KiB
Org Babel: Literate Programming
- What is Org Babel
- Supported languages
- Example: Python block
- Example: Shell
- Tangle: exporting code to files
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.