Skip to main content
  1. Posts/

Org Mode and Org Capture

Org-Mode #

Since I already had Emacs(mentioned in this blog post), I thought why not at least try the rumoured, the killer feature of the Emacs, the org-mode. And I was not disappointed.
I am not new to text based note taking apps. Before moving to Emacs and org I was using obsidian on daily basis and I was more than satisfied with it. Great cross-platform applications(electron based but still) and huge plugin support. But after using org-mode, I cannot think of going back. Shows winning against almost two decades of development is not easy1.
Org-mode is not a single tool, there are different modules that come with it and also there are org-related packages too(org-roam for one). I currently use org-roam to create notes, org-babel to run code snippets inside org files, org-roam-ui to get a nice visualization of org-roam notes, org-contacts to organize contacts, org-journal to write about my day, org-agenda to write and manage my habits, projects and todos which I keep synced on my smartphone for orgzly and emacs on termux. And in my opinion one of the most important tool to integrate these all in day to day life is the org-capture.

Org-Capture #

Org-capture lets you create templates and call and fill them whenever, wherever, and however you want. For example you are working on your project, you can call todo capture and save your todo note with file and line from which you called org-capture stored for more context later.

(use-package org-capture
  :ensure nil
  :after org
  :preface
  (defvar my/org-contacts-template "* %(org-contacts-template-name)
  :PROPERTIES:
  :ALIAS: %^{ALIAS}
  :NICKNAME: %^{nickname}
  :PHONE: %^{Phone no}
  :BIRTHDAY: %^{yyyy-mm-dd}
  :EMAIL: %(org-contacts-template-email)
  :ADDRESS: %^{Address}
  :NOTE: %^{NOTE}
  :END:" "Template for org-contacts.")

  :custom
  (org-capture-templates
   `(("c" "Friend Contact" entry (file+headline "/path/to/contact/file.org" "Friends_Heading"),
      my/org-contacts-template
      :empty-lines 1)
     ("t" "Todo" entry (file+headline "/path/to/todo/file.org" "Tasks_Heading")
      "* TODO %?\n  %i\n  %a")
     ("i" "Idea" entry (file+headline "/path/to/ideas/file.org" "Ideas_Heading")
         "* IDEA %^{In Brief}\nCREATED: %U\n%?")
        )))

You should start seeing patterns. First we input the key, after that name of the capture. Broadly format looks like this.

(org-capture-templates
   `(("kbd-key-1" "Org-cature-1-name" entry (file+headline "/path/to/org/file-1.org" "Heading"),
      my/template-name(if already defined one))
      ("kbd-key-2" "Org-catpure-2-name" entry (file+headline "/path/to/org/file.org" "Heading"),
      template_here))

For a list of template expansions check out org-mode manual.


  1. Org-mode was created in 2003. ↩︎