In the template itself, special “%-escapes”86 allow dynamic insertion of content. The templates are expanded in the order given here:
Insert the contents of the file given by FILE.
Evaluate Elisp expression EXP and replace it with the result. The EXP form must return a string. Only placeholders pre-existing within the template, or introduced with ‘%[file]’, are expanded this way. Since this happens after expanding non-interactive “%-escapes”, those can be used to fill the expression.
The result of format-time-string on the FORMAT specification.
Timestamp, date only.
Timestamp, with date and time.
Like ‘%t’, ‘%T’ above, but inactive timestamps.
Initial content, the region when capture is called while the region is active. If there is text before ‘%i’ on the same line, such as indentation, and ‘%i’ is not inside a ‘%(exp)’ form, that prefix is added before every line in the inserted text.
Annotation, normally the link created with org-store-link
.
Like ‘%a’, but prompt for the description part.
Like ‘%a’, but only insert the literal link.
Like ‘%l’, but without brackets (the link content itself).
Current kill ring head.
Content of the X clipboard.
Title of the currently clocked task.
Link to the currently clocked task.
User name (taken from user-full-name
).
File visited by current buffer when org-capture was called.
Full path of the file or directory visited by current buffer.
Specific information for certain link types, see below.
Prompt for tags, with completion on tags in target file.
Prompt for tags, with completion all tags in all agenda files.
Like ‘%t’, but prompt for date. Similarly ‘%^T’, ‘%^u’, ‘%^U’. You may define a prompt like ‘%^{Birthday}t’.
Interactive selection of which kill or clip to use.
Like ‘%^C’, but insert as link.
Prompt the user for a value for property PROP. You may specify a default value with ‘%^{PROP|default}’.
Prompt the user for a string and replace this sequence with it. You may specify a default value and a completion table with ‘%^{prompt|default|completion2|completion3...}’. The arrow keys access a prompt-specific history.
Insert the text entered at the Nth ‘%^{PROMPT}’, where N is a number, starting from 1.
After completing the template, position point here.
For specific link types, the following keywords are defined87:
Link type | Available keywords |
---|---|
bbdb | ‘%:name’, ‘%:company’ |
irc | ‘%:server’, ‘%:port’, ‘%:nick’ |
mh, rmail | ‘%:type’, ‘%:subject’, ‘%:message-id’ |
‘%:from’, ‘%:fromname’, ‘%:fromaddress’ | |
‘%:to’, ‘%:toname’, ‘%:toaddress’ | |
‘%:date’ (message date header field) | |
‘%:date-timestamp’ (date as active timestamp) | |
‘%:date-timestamp-inactive’ (date as inactive timestamp) | |
‘%:fromto’ (either “to NAME” or “from NAME”)88 | |
gnus | ‘%:group’, for messages also all email fields |
w3, w3m | ‘%:url’ |
info | ‘%:file’, ‘%:node’ |
calendar | ‘%:date’ |
org-protocol | ‘%:link’, ‘%:description’, ‘%:annotation’ |
If you need one of these sequences literally, escape the ‘%’ with a backslash.
If
you define your own link types (see Adding Hyperlink Types), any
property you store with org-store-link-props
can be accessed in
capture templates in a similar way.
This is always the other, not the user. See the variable
org-link-from-user-regexp
.