The org documentation describes various %-escape codes in a capture template. I'm having difficulty getting %\n to work. The relevant portion of the doc says:
%\n Insert the text entered at the nth %^{prompt}, where n is a number, starting from 1.
The following is a snippet from my capture templates where I use that particular escape code:
("i" "Interrupts")
(
"io" ; key
"Other" ; description
entry ; type
(file+headline "~/git/org/agenda/refile.org" "Interrupts") ; target
"* IRQ from %^{Name}: %^{Subject} :%\1:\n\n%?" ; template
:prepend t ; properties
:clock-in t ; properties
:clock-resume t ;
:empty-lines 1 ; properties
)
My expectation for the entry header generated by that template, if I enter "Fred" and "SomeSubject" for the two prompts, is something like this:
However, the %\1 is not being expanded correctly and instead I get:
To check in case the problem was that I had placed the %\1 inside a tag, I also tried it like this:
But it still didn't work and is giving:
Any ideas what I'm doing wrong?
thx.
You need to escape the the backslash similar to regular expressions. Try %\\1.