Retain the Context in Org Capture notes

Published on Nov 6, 2021, by Junji Zhi

When we capture an idea, it’s useful to keep the context.

When we go back to the notes later, we don’t waste time to dig the context and look for details.

It’s convenient that all things are just there when we need it.

In org capture template, I found the template expansion %a good enough for this purpose.

‘%a’

    Annotation, normally the link created with org-store-link.

My org capture template looks something like:

(setq org-capture-templates
      '(("t" "Todo" entry (file+headline "~/org/gtd.org" "Tasks")
         "* TODO %?\n  %i\n  %a")
       ("n" "Note" entry
          (file+headline "~/org/notes.org" "Notes")
          "* %?
** Content

** References
- %a

%T
")))

When I fire M-x org-capture command and choose note, the capture buffer will something like:

** 
*** Content

*** References
- [[file:~/../_posts/2021-11-05-retain-the-linkcontext-in-org-capture-notes.md][:~/../_posts/2021-11-05-retain-the-linkcontext-in-org-capture-notes.md]]

<2021-11-05 Fri 20:30>

It has two sections, one for content and the other for references, where it links to the buffer where the idea was generated.

The links works well Magit commit diffs or elfeed RSS articles, too. This is especially useful for developers who have ideas while deep in the code or reading a RSS feed.

If you use org-roam, The same template works for org-roam-capture, too!

With this tweak, you can jot down ideas quickly, commit and forget. Rest assured Org keeps the context for you!