=org-tempo=[fn:1: https://orgmode.org/org.html#Structure-Templates ] provides easy templating in org-mode buffers and I use them to make it easier to write code for the CCE. I can tab across <s and <q to expand to source and quote blocks along with many others (and it's customisable of course through org-tempo-keywords-alist.)
(provide 'cce/literate-programming)
(use-package org-tempo
:ensure nil
:after org)Bernt Hansen provides a function and a hook to automatically show images after org-babel executes:
(add-hook 'org-babel-after-execute-hook 'bh/display-inline-images 'append)
(defun bh/display-inline-images ()
(condition-case nil
(org-display-inline-images)
(error nil)))Do not prompt to confirm evaluation. This may be dangerous - make sure you understand the consequences. I'm of two minds here; on the one hand hanging to confirm every source block is terrible but on the other hand I'd like to have some modicum of security. In reality I should set this only for my own files somehow.
(setq org-confirm-babel-evaluate nil)Leave comments in the tangle to make it easier to untangle later on; I will mainly be using this in Lipu Kasi - A Plant Diary
(add-to-list 'org-babel-default-header-args '(:comments . "link"))Configure what languages I want to use for org-babel:
(org-babel-do-load-languages 'org-babel-load-languages
'((emacs-lisp . t)
(dot . t)
(ditaa . t)
(python . t)
(ruby . t)
(gnuplot . t)
(shell . t)
(org . t)
(plantuml . t)
(js . t)))Output to a lowercase'd results block.
(setq org-babel-results-keyword "results")This helper sets web-mode to use Elixir when I set a source block's type to eex
(defadvice org-edit-special (before org-edit-src-code activate)
(let ((lang (nth 0 (org-babel-get-src-block-info))))
(if (string= lang "web")
(web-mode-set-engine "elixir"))))Finally org-edit-src simply cannot steal my window configuration from me.
(setq org-src-window-setup 'current-window)org-auto-tangle configuration; any buffer with a keyword of #+auto_tangle to non-nil will tangle on save.
(use-package org-auto-tangle
:defer t
:diminish
:hook (org-mode . org-auto-tangle-mode))(setq org-plantuml-executable-path "/nix/store/gyznjv622jqc8d1x56r7c4wp2rq8md7m-plantuml-1.2023.1/bin/plantuml")