org-capture-templates

org-capture-templates is a variable defined in `org-capture.el'.
Its value is
nil


Documentation:
Templates for the creation of new entries.

Each entry is a list with the following items:

keys The keys that will select the template, as a string, characters
only, for example "a" for a template to be selected with a
single key, or "bt" for selection with two keys. When using
several keys, keys using the same prefix key must be together
in the list and preceded by a 2-element entry explaining the
prefix key, for example

("b" "Templates for marking stuff to buy")

The "C" key is used by default for quick access to the
customization of the template variable. But if you want to use
that key for a template, you can.

description A short string describing the template, will be shown during
selection.

type The type of entry. Valid types are:
entry an Org-mode node, with a headline. Will be
filed as the child of the target entry or as
a top-level entry.
item a plain list item, will be placed in the
first plain list at the target
location.
checkitem a checkbox item. This differs from the
plain list item only is so far as it uses a
different default template.
table-line a new line in the first table at target location.
plain text to be inserted as it is.

target Specification of where the captured item should be placed.
In Org-mode files, targets usually define a node. Entries will
become children of this node, other types will be added to the
table or list in the body of this node.

Most target specifications contain a file name. If that file
name is the empty string, it defaults to `org-default-notes-file'.
A file can also be given as a variable, function, or Emacs Lisp
form.

Valid values are:

(file "path/to/file")
Text will be placed at the beginning or end of that file

(id "id of existing org entry")
File as child of this entry, or in the body of the entry

(file+headline "path/to/file" "node headline")
Fast configuration if the target heading is unique in the file

(file+olp "path/to/file" "Level 1 heading" "Level 2" ...)
For non-unique headings, the full path is safer

(file+regexp "path/to/file" "regexp to find location")
File to the entry matching regexp

(file+datetree "path/to/file")
Will create a heading in a date tree for today's date

(file+datetree+prompt "path/to/file")
Will create a heading in a date tree, prompts for date

(file+function "path/to/file" function-finding-location)
A function to find the right location in the file

(clock)
File to the entry that is currently being clocked

(function function-finding-location)
Most general way, write your own function to find both
file and location

template The template for creating the capture item. If you leave this
empty, an appropriate default template will be used. See below
for more details. Instead of a string, this may also be one of

(file "/path/to/template-file")
(function function-returning-the-template)

in order to get a template from a file, or dynamically
from a function.

The rest of the entry is a property list of additional options. Recognized
properties are:

:prepend Normally newly captured information will be appended at
the target location (last child, last table line,
last list item...). Setting this property will
change that.

:immediate-finish When set, do not offer to edit the information, just
file it away immediately. This makes sense if the
template only needs information that can be added
automatically.

:jump-to-captured When set, jump to the captured entry when finished.

:empty-lines Set this to the number of lines the should be inserted
before and after the new item. Default 0, only common
other value is 1.

:empty-lines-before Set this to the number of lines the should be inserted
before the new item. Overrides :empty-lines for the
number lines inserted before.

:empty-lines-after Set this to the number of lines the should be inserted
after the new item. Overrides :empty-lines for the
number of lines inserted after.

:clock-in Start the clock in this item.

:clock-keep Keep the clock running when filing the captured entry.

:clock-resume Start the interrupted clock when finishing the capture.
Note that :clock-keep has precedence over :clock-resume.
When setting both to `t', the current clock will run and
the previous one will not be resumed.

:unnarrowed Do not narrow the target buffer, simply show the
full buffer. Default is to narrow it so that you
only see the new stuff.

:table-line-pos Specification of the location in the table where the
new line should be inserted. It should be a string like
"II-3", meaning that the new line should become the
third line before the second horizontal separator line.

:kill-buffer If the target file was not yet visited by a buffer when
capture was invoked, kill the buffer again after capture
is finalized.

The template defines the text to be inserted. Often this is an
org-mode entry (so the first line should start with a star) that
will be filed as a child of the target headline. It can also be
freely formatted text. Furthermore, the following %-escapes will
be replaced with content and expanded in this order:

%[pathname] Insert the contents of the file given by `pathname'.
%(sexp) Evaluate elisp `(sexp)' and replace it with the results.
For convenience, %:keyword (see below) placeholders within
the expression will be expanded prior to this.
%<...> The result of format-time-string on the ... format specification.
%t Time stamp, date only.
%T Time stamp with date and time.
%u, %U Like the above, but inactive time stamps.
%i Initial content, copied from the active region. If %i is
indented, the entire inserted text will be indented as well.
%a Annotation, normally the link created with `org-store-link'.
%A Like %a, but prompt for the description part.
%l Like %a, but only insert the literal link.
%c Current kill ring head.
%x Content of the X clipboard.
%k Title of currently clocked task.
%K Link to currently clocked task.
%n User name (taken from the variable `user-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 on all tags in all agenda files.
%^t Like %t, but prompt for date. Similarly %^T, %^u, %^U.
You may define a prompt like: %^{Please specify 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.
A default value and a completion table ca be specified like this:
%^{prompt|default|completion2|completion3|...}.
%? After completing the template, position cursor here.
%\n Insert the text entered at the nth %^{prompt}, where `n' is
a number, starting from 1.

Apart from these general escapes, you can access information specific to
the link type that is created. For example, calling `org-capture' in emails
or in Gnus will record the author and the subject of the message, which you
can access with "%:from" and "%:subject", respectively. Here is a
complete list of what is recorded for each link type.

Link type | Available information
------------------------+------------------------------------------------------
bbdb | %:type %:name %:company
vm, wl, mh, mew, rmail, | %:type %:subject %:message-id
gnus | %:from %:fromname %:fromaddress
| %:to %:toname %:toaddress
| %:fromto (either "to NAME" or "from NAME")
| %:date %:date-timestamp (as active timestamp)
| %:date-timestamp-inactive (as inactive timestamp)
gnus | %:group, for messages also all email fields
w3, w3m | %:type %:url
info | %:type %:file %:node
calendar | %:type %:date

You can customize this variable.

This variable was introduced, or its default value was changed, in version 24.1 of Emacs.