Previous: Template elements, Up: Capture templates
In the template itself, special %-escapes1 allow dynamic insertion of content. The templates are expanded in the order given here:
%[file] insert the contents of the file given by file. %(sexp) evaluate Elisp sexp and replace with the result. %<...> the result of format-time-string on the ... format specification. %t timestamp, date only. %T timestamp with date and time. %u, %U like the above, but inactive timestamps. %a annotation, normally the link created withorg-store-link. %i initial content, the region when capture is called while the region is active. The entire text will be indented like%iitself. %A like%a, but prompt for the description part. %c Current kill ring head. %x Content of the X clipboard. %k title of the currently clocked task. %K link to the currently clocked task. %n user name (taken fromuser-full-name). %f file visited by current buffer when org-capture was called. %F full path of the file or directory visited by current buffer. %:keyword specific information for certain link types, see below. %^g prompt for tags, with completion on tags in target file. %^G prompt for tags, with completion all tags in all agenda files. %^t like%t, but prompt for date. Similarly%^T,%^u,%^U. You may define a prompt like%^{Birthday}t. %^C Interactive selection of which kill or clip to use. %^L Like%^C, but insert as link. %^{prop}p Prompt the user for a value for property prop. %^{prompt} 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.
For specific link types, the following keywords will be defined2:
Link type | Available keywords
------------------------+----------------------------------------------
bbdb | %:name %:company
irc | %:server %:port %:nick
vm, wl, mh, mew, 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")3
gnus | %:group, for messages also all email fields
w3, w3m | %:url
info | %:file %:node
calendar | %:date
To place the cursor after template expansion use:
%? After completing the template, position cursor here.
[1] If you need one of these sequences literally, escape the % with a backslash.
[2] 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.
[3] This will always be the other, not the user. See the variable org-from-is-user-regexp.