Org capture templates can prompt for user input, but then only inserts it at one location. This is quite limiting. The template I created asked for a JIRA ticket number and I wanted to use it throughout my template without prompting for the same thing again.

But org capture supports custom lisp expressions. That's like allowing cheat codes. Super powerful. So I wrote a function that will prompt the user for a string, save it to a buffer local variable and return it (so it is inserted at the first location).

( defvar oc-capture-prmt-history nil "History of prompt answers for org capture." ) ( defun oc/prmt ( prompt variable ) "PROMPT for string, save it to VARIABLE and insert it." ( make-local-variable variable ) ( set variable ( read-string ( concat prompt ": " ) nil oc-capture-prmt-history ) ) )

For inserting progn is all you need. So let's say I have a capture template like this:

* JIRA Ticket %(oc/prmt "JIRA Project" 'jr-prj)-%(oc/prmt "JIRA Ticket No." 'jr-no) For project %(prgn jr-prj) I have to do the following stuff: * * Triage %(progn jr-prj)-%(progn jr-no) Do the triage. * * Implement %(progn jr-prj)-%(progn jr-no) Implement stuff - [ ] Tests pass?

It has two calls to oc/prmt in the first heading and several calls to oc/ins afterwards.

Orc capture will first prompt for the JIRA project:

Then for the ticket number: