Nice example, the one you provided
I heavily use variables in org-capture templates [0]. I use a function
that I called m/p [1]. My most complex example is a template for
invoicing [2]: I use series of org-captures for quote, draft invoice,
invoice and corrective invoice, which includes export to PDF from latex
and control with plaintext tool hledger.
[0]
[2025-12-22 Mon 19:00:35] $ rg -c 'm/p' org-capture-templates/
org-capture-templates/qirdoc.org:47
org-capture-templates/twclocktables.org:1
org-capture-templates/task_hybrid.org:5
org-capture-templates/project_hybrid.org:26
org-capture-templates/task_inbox.org:2
org-capture-templates/media.org:1
org-capture-templates/appointment_hybrid.org:5
[1]
https://codeberg.org/pedroberg/pinmacs-emacs-config/src/commit/6813c5b48fb86fc142bc4e581965f1e1b11e6ef8/emacs-config.org?display=source#L8422-L8424
(defun m/p (var)
"my print function"
(format "%s" var))
[2]
https://codeberg.org/pedroberg/pinmacs-emacs-config/src/commit/6813c5b48fb86fc142bc4e581965f1e1b11e6ef8/org-capture-templates/qirdoc.org?display=source