-- Capture Backgrounder --
Org-capture is global, may be called from anywhere in Emacs.
Calling org-capture displays a buffer which accepts notes.
Closing the buffer saves those notes.
Org-capture is customizable as to
the types of notes
where the notes are saved
-- Capture By Example --
(Six steps.)
1) Invoke Org-Capture
via "M-x org-capture"
there is no default key binding but one can be set
Emacs presents you with a menu like this...
[t] Task
[C] Customize
[q] Abort
2) Create A New Task
Select "t" from the menu shown above, and you get an org-mode buffer that looks like...
Capture buffer. Finish 'C-c C-c', refile 'C-c C-w', abort 'C-c C-k'.
*** TODO
[2022-03-01 Tue]
[[file:~/../foo.org]]
3) Enter The Note’s Text Following The "TODO"
4) Save And Exit
via "C-c C-c"
Emacs saves the new task
the default storage location is "~/.notes"
this can also be customized
Saved notes look like...
Tasks
** TODO Test
[2022-02-10 Thu]
[[file:~/Lib/2022-DEV/11-Org-Doc/Howardism--Capturing/01-Notes/org-capture.org::
*Example][Example]] Totally bogus.
** TODO Foo
[2022-02-10 Thu]
[[file:~/Lib/2022-DEV/11-Org-Doc/Howardism--Capturing/01-Notes/org-capture.org::
*Customizing][Customizing]]
5) To Customize Capture...
select "C" for "Customize org-capture-templates"
you get an org-mode buffer that contains a whole bunch of stuff (see below)
6) To Abort, Select "q"
and then it does
so, nothing to see here
-- Capture Commands --
From org manual (v 9.5, section 10.1.2, "Using capture")
M-x org-capture | display the capture templates menu |
C-c C-c (org-capture-finalize) | resume at previous location |
C-c C-w (org-capture-refile) | refile the note to a different place |
C-c C-k (org-capture-kill) | abort capture & resume at previous location |
C-u M-x org-capture | visit the target location of a capture template |
C-u C-u M-x org-capture | visit the last stored capture item in its buffer |
-- Others --
org-capture-goto-last-stored
interactive compiled Lisp function
takes user to the location where the last capture note was store
org-capture
is an interactive compiled Lisp function: (- org-capture &optional GOTO
KEYS) used to capture something
This will let you select a template from '- org-capture-templates', and then
file the newly captured information.
The text is immediately inserted at the target location, and an indirect buffer
is shown where you can edit it.
Pressing 'C-c C-c' brings you back to the previous state of Emacs, so that you
can continue your work.
When called interactively with a 'C-u' prefix argument GOTO, don’t capture
anything, just go to the file/headline where the selected template stores its
notes.
With a 'C-u C-u' prefix argument, go to the last note stored.
When called with a 'C-0' (zero) prefix, insert a template at point.
When called with a 'C-1' (one) prefix, force prompting for a date when a
datetree entry is made.
ELisp programs can set KEYS to a string associated with a template in '-
org-capture-templates'. In this case, interactive selection will be bypassed.
If '- org-capture-use-agenda-date' is non-nil, capturing from the agenda will
use the date at point as the default date. Then, a 'C-1' prefix will tell the
capture process to use the HH:MM time of the day at point (if any) or the
current HH:MM time.
org-capture-finalize
is an interactive compiled Lisp function: (- org-capture-finalize &optional
STAY-WITH-CAPTURE) to finalize the capture process
with prefix argument STAY-WITH-CAPTURE, jump to the location of the captured
item after finalizing
org-capture-goto-last-stored
is an interactive compiled Lisp function: (- org-capture-goto-last-stored)
go to the location where the last capture note was stored
org-capture-goto-target
is an interactive compiled Lisp function: (- org-capture-goto-target
&optional TEMPLATE-KEY)
go to the target location of a capture template. The user is queried for the
template
org-capture-kill
is an interactive compiled Lisp function: (- org-capture-kill)
abort the current capture process
org-capture-mode
is an interactive compiled Lisp function: (- org-capture-mode &optional ARG)
is a minor mode for special key bindings in a capture buffer
turning on this mode runs the normal hook '- org-capture-mode-hook'
org-capture-refile
is an interactive compiled Lisp function: (- org-capture-refile)
finalize the current capture and then refile the entry
refiling is done from the base buffer, because the indirect buffer is then
already gone any prefix argument will be passed to the refile command
org-capture-string
is an interactive compiled Lisp function: (- org-capture-string STRING
&optional KEYS)
capture STRING with the template selected by KEYS
-- Customizing Capture --
Change Where Notes Are Stored
(setq org-default-notes-file "~/pathname/filename.org")
Customize The Templates
Each has at least 3 parts.
- a key binding to select a particular template
- a destination file, and sections in that file, like heading, sub-heading, list item, etc
- a formatting template to handle routine details
Template Customizing By Example
The following adds a "w" (work-related) task in addition to the "t" (task)
(add-to-list 'org-capture-templates
'("w" "Work-related Task" entry
(file "~/pathname/notes/work.org")
" TODO %?" :empty-lines 1))
and the following re-adds the default, so both the "t" option and the "w" option show up
(add-to-list 'org-capture-templates
'("t" "Personal Task" entry
(file org-default-notes-file)
" TODO %?" :empty-lines 1))
Using More Than One Template
(from Org Manual 9.5, 10.1.3 Capture templates p107-113)
One template is for general TODO entries.
under the heading 'Tasks'
filed at '~/org/gtd.org'
its hotkey is "t"
The other is for capturing journal entries.
in a "date tree"
filed at '~/../journal.org'
its hotkey is "j"
Pressing "t" from the capture menu has Org create a task entry for a "TODO" item. Likewise for "j" and corresponding "journal" entries.
Org Documentation For Template Customizing
The text block below is exactly what emacs presents when user runs "M-x org-capture" and selects "C" for "customize".
The bits in "[Brackets]" below are displayed by emacs as its version of buttons (just so you know).
For help using this buffer, see Easy Customization in the Emacs manual.
[Search]
Operate on all settings in this buffer:
[Revert...] [Apply] [Apply and Save]
Org Capture Templates:
[INS]
[State] : STANDARD.
Templates for the creation of new entries. Hide
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 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 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 or as a function called
with no argument. When an absolute path is not specified for a
target, it is taken as relative to 'org-directory'.
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 outline path is safer
(file+regexp "path/to/file" "regexp to find location")
File to the entry matching regexp
(file+olp+datetree "path/to/file" "Level 1 heading" ...)
Will create a heading in a date tree for today’s date.
If no heading is given, the tree will be on top level.
To prompt for date instead of using TODAY, use the
:time-prompt property. To create a week-tree, use the
:tree-type property.
(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 which both visits
the file and moves point to the right 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.
:time-prompt Prompt for a date/time to be used for date/week trees
and when filling the template.
:tree-type When 'week', make a week tree instead of the month tree.
: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:
%[pathname] Insert the contents of the file given by
'pathname'. These placeholders are expanded at the very
beginning of the process so they can be used to extend the
current template.
%(sexp) Evaluate elisp '(sexp)' and replace it with the results.
Only placeholders pre-existing within the template, or
introduced with %[pathname] 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.
%t Time stamp, date only. The time stamp is the current time,
except when called from agendas with 'M-x org-agenda-capture' or
with 'org-capture-use-agenda-date' set.
%T Time stamp as above, 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.
The default date is that of %t, see above.
%^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.
%\1 ... %\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
eww, w3, w3m | %:type %:url
info | %:type %:file %:node
calendar | %:type %:date
When you need to insert a literal percent sign in the template,
you can escape ambiguous cases with a backward slash, e.g., \%i.
Groups: Org Capture
And that is all we have for today.
See tabs at the top for definitions and books.
Have anything worth adding? Then try sosayseff+nosey@nullabigmail.com
Me? Recently confused by life. Like starting in kindergarten.