org-tempofn1 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.)
emacs-lisp source:(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:
emacs-lisp source:(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.
emacs-lisp source:(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
emacs-lisp source:(add-to-list 'org-babel-default-header-args '(:comments . "link"))
Configure what languages I want to use for org-babel:
emacs-lisp source:(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.
emacs-lisp source:(setq org-babel-results-keyword "results")
This helper sets web-mode to use Elixir when I set a source block's type to eex
emacs-lisp source:(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.
emacs-lisp source:(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.
emacs-lisp source:(use-package org-auto-tangle :defer t :diminish :hook (org-mode . org-auto-tangle-mode))
emacs-lisp source:(setq org-plantuml-executable-path "/nix/store/gyznjv622jqc8d1x56r7c4wp2rq8md7m-plantuml-1.2023.1/bin/plantuml")