Org-mode basics VI: A simple TODO list

In the first part of my series on org-mode, I described how to create a rich structured notebook that can be exported to various useful formats. In the next few posts in this series I’m going to talk about another essential way I use org-mode, which is to organise myself! I use org-mode to manage my (depressingly long) task list including scheduled tasks and deadlines, to export a calendar feed for events, and to quickly capture useful information including emails and scanned documents. If you want to see a very advanced use case, look at Bernt Hansen’s Org Mode – Organize Your Life In Plain Text.

In this post, we’ll start by looking at setting up a simple todo list, and we’ll cover some of the more advanced topics later.

To start with, add the following code to your emacs config file:

;; set key for agenda
(global-set-key (kbd "C-c a") 'org-agenda)

;;file to save todo items
(setq org-agenda-files (quote ("/Users/bjm/todo.org")))

;;set priority range from A to C with default A
(setq org-highest-priority ?A)
(setq org-lowest-priority ?C)
(setq org-default-priority ?A)

;;set colours for priorities
(setq org-priority-faces '((?A . (:foreground "#F0DFAF" :weight bold))
                           (?B . (:foreground "LightSteelBlue"))
                           (?C . (:foreground "OliveDrab"))))

;;open agenda in current window
(setq org-agenda-window-setup (quote current-window))

;;capture todo items using C-c c t
(define-key global-map (kbd "C-c c") 'org-capture)
(setq org-capture-templates
      '(("t" "todo" entry (file+headline "/Users/bjm/todo.org" "Tasks")
         "* TODO [#A] %?")))

This sets up the file in which we will save our todo items (put your own choice of file here), configures a few other options, and sets up a capture template to quickly add todo items to the list (put the same file name for your todo file here too). Now you can highlight the code in your config file and use M-x eval-region or restart emacs to pick up the changes.

Once you have done this you can add your first todo item using C-c c t, which will pop up a small window with a prompt like this

** TODO [#A]

You can see this looks like an org-mode headline, and you should add your todo item and any notes to go with is to this like so:

** TODO [#A] make a todo list
Some notes here about how to do it

Then hit C-c C-c to save this item. The nice thing about this method of adding items (called org-capture) is that you can add an item from anywhere in emacs and get right back to what you were doing afterwards.

By default our item was given priority A, but you can change this easily by hitting shift and up or down arrow to cycle through the priority levels (I find that three levels, A-C is enough for me).

Let’s add a priority B item:

** TODO [#B] add another item to my list

Now we can have a look at our todo list using C-c a to launch the “agenda dispatcher”, a powerful interface for selecting different ways to view your tasks. For now we’ll just hit t in the dispatcher to view the todo items (i.e. use C-c a t). This switches to a buffer with our todo list – in this list view, you might want to:

  • Cross an item off your list (the best bit!). To do this put the cursor on the corresponding line and hit $ which marks it as done and archives the item in a file called todo.org_archive getting rid of it from your todo list.
  • Change the priority of an item using shift up/down.
  • View the notes to go with items by hitting E.
  • Edit or view an item in more detail by hitting RET with the cursor on the item that you want. This takes you to the item in your todo.org file where you can edit it or look at the notes you added to it in more detail.
  • Quit back to where you were before with q

That is all there is to it, and you now have a simple but powerful todo list in emacs. Just remember C-c c t to create a todo item and C-c a t to view the todo list.

That’s all for now. In the next part we’ll look at scheduling and deadlines.