https://github.com/daviwil/emacs-from-scratch
Execution: C-c C-c
(output, value results)
https://orgmode.org/worg/org-contrib/babel/ https://orgmode.org/worg/org-contrib/babel/languages.html
42
(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . t)
(python . t)))
(setq org-confirm-babel-evaluate nil)
;; This is needed as of Org 9.2
(require 'org-tempo)
(add-to-list 'org-structure-template-alist '("sh" . "src shell"))
(add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
(add-to-list 'org-structure-template-alist '("py" . "src python"))
Apply the same configuration to every block:
(org-babel-tangle)
(org-babel-tangle-file "~/Projects/Code/emacs-from-scratch/Emacs.org")
(push '("conf-unix" . conf-unix) org-src-lang-modes)
value=42
To create output directories automatically, add :mkdirp yes
Enables you to pass variables into a source block!
55
Add :noweb yes
!
value=<<the-value>>
Per-System Settings
- Automatically tangle on save
- Should I also commit tangle output?
;; Automatically tangle our Emacs.org config file when we save it
(defun efs/org-babel-tangle-config ()
(when (string-equal (buffer-file-name)
(expand-file-name "~/Projects/Code/emacs-from-scratch/Emacs.org"))
;; Dynamic scoping to the rescue
(let ((org-confirm-babel-evaluate nil))
(org-babel-tangle)))
(add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'efs/org-babel-tangle-config)))