1

I am trying to create a org-capture template that re-uses some text given with the ‘%^{PROMPT}’ expansion along several points of the created note.

I have looked in this link and in stack overflow for such an option without success.

("J" "Jobs" entry (file+headline "~/org/NOTES.org" "Jobs") ; jobs
"* TODO %^{Name of Job}\nSCHEDULED: %(org-insert-time-stamp (org-read-date nil t \"+0d\"))\n 
- [[%x][Advert]] \n 
- Coverletter pdf \n 
- [[file:~/Documents/Personal/CV/CV.tex][CV]] [[file:~/Documents/Personal/CV/CV.pdf][pdf]] \n 
- [[shell:mkdir -p ~/Documents/Personal/$(date +%Y%M_%^{Name of Job})][makedir]]")

The above example prompts me for "Name of Job" in two separate instances. I would like to re-use the information that I have given to fill the template automatically.

3

On the page you linked, it says you can reuse a prompt value with %\1. Instead of %^{Name of Job} twice, use %\\1 for the second occurrence in your template. You'll need the extra \ because it's inside a string and needs to be escaped.

("J" "Jobs" entry (file+headline "~/org/NOTES.org" "Jobs") ; jobs
"* TODO %^{Name of Job}\nSCHEDULED: %(org-insert-time-stamp (org-read-date nil t \"+0d\"))\n 
- [[%x][Advert]] \n 
- Coverletter pdf \n 
- [[file:~/Documents/Personal/CV/CV.tex][CV]] [[file:~/Documents/Personal/CV/CV.pdf][pdf]] \n 
- [[shell:mkdir -p ~/Documents/Personal/$(date +%Y%M_%\\1)][makedir]]")
  • There are so many options that I've missed that one. Thank you very much for pointing it out, and the detail of the \. – Andre Jun 14 at 23:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.