Skip to main content

C'est la Z

Using Emacs - 23 - Org Capture 1

Org mode has an amazing feature - org-capture. I only started using it recently but it's really awesome.

What took me so long?

Probably that the manual seemed a little intimidating.

It really isn't hard, though. Combined with what I'll go over in the next video and post (and a future one for Google calendar sync) it's what I use for:

  • recording blog ideas
  • managing bookmarks
  • taking short Notes
  • managing my calendar.

I use the binding:

(global-set-key (kbd "C-c c")

By default, running org-capture brings up a form to capture a "task" but things get really cool when you start making your own capture templates. With capture templates, you can speed up recording information and then tell org-mode to store it where you want it.

Here are my template settings.

(setq org-capture-templates
'(("a" "Appointment" entry (file  "~/Dropbox/orgfiles/" "Appointments")
"* TODO %?\n:PROPERTIES:\n\n:END:\nDEADLINE: %^T \n %i\n")
("n" "Note" entry (file+headline "~/Dropbox/orgfiles/" "Notes")
"* Note %?\n%T")
("l" "Link" entry (file+headline "~/Dropbox/orgfiles/" "Links")
"* %? %^L %^g \n%T" :prepend t)
("b" "Blog idea" entry (file+headline "~/Dropbox/orgfiles/" "Blog Topics:")
"* %?\n%T" :prepend t)
("t" "To Do Item" entry (file+headline "~/Dropbox/orgfiles/" "To Do Items")
"* %?\n%T" :prepend t)
("j" "Journal" entry (file+datetree "~/Dropbox/")
"* %?\nEntered on %U\n  %i\n  %a")
("s" "Screencast" entry (file "~/Dropbox/orgfiles/")
"* %?\n%i\n")))

Let's look at the Blog entry:

("b" "Blog idea" entry (file+headline "~/Dropbox/orgfiles/" "Blog Topics:")
"* %?\n%T" :prepend t)

It's a list with a bunch of options. The first string b is the key to type to select this template, Blog idea is the actual name for this template.

The next item, entry describes the type of template you're creating. entry says you're going to create an org node with a headline which can then be added to an org-file. You can also have your template create things like an org list item a checkbox checkitem or even plain text. You can see the full set of options here.

Next, in parentheses, you have the target - where to store the captured info. The Blog idea template says file+headline followed by a filename in quotes and a headline in quotes. This says to store the new org heading you're capturing in the file "~/Dropbox/orgfiles/" under the heading "Blog Topics:" Contrast this to the appointments template which just specifies file and a filename. The appointments template will just append the new appointment to its specified file whereas Blog idea will prepend (due to the :prepend option at the end of the template) to the "Blog Topics:" heading in

After this we have the actual template: "* %?\n%T" - the %? and %T are placeholders for substitutions. The %T prompts for a date with a timestamp and the %? is where to leave the cursor for final input before saving the capture.

Finally, :prepend and other options can be found at the above link.

All the substitutions can be found in the docs.

Once you've set up your templates, it's quick and easy to capture information.

This video shows the basics. The next one shows how to pop up a capture even when you're not in emacs and how I use org-capture to maintain my web bookmarks.

More information on capture templates can be found here.

Relevant links:

comments powered by Disqus