I have this in my init file
(use-package autoinsert
:ensure t
:init
;; Don't want to be prompted before insertion:
(setq auto-insert-query nil)
(setq auto-insert-directory (locate-user-emacs-file "templates"))
(add-hook 'find-file-hook 'auto-insert)
(auto-insert-mode 1)
:config
(define-auto-insert "poolchem.org?$" "poolchem.org"))
IOW, I have the template file poolchem.org
in ~/.emacs.d/templates/
, which contains six tables. I went this route because it seemed easier than hand-tooling such a big thing in (customize-variable 'auto-insert-alist)
. But I would like various bits of embedded initialization code to run upon creating poolchem.org
, e.g.,
(org-read-date nil nil "++mon" nil (org-time-string-to-time "2020-03-31"))
should place the date of the next Monday after 2020-03-31 in the text upon file open. How can I do this? I've experimented with eval of org-sbe
in # local variables: ...
but that was handy for running code blocks upon file open, not individual embedded functions.