To-do Lists with Org
Among Emacs enthusiasts I think I have been a latecomer to org-mode. Truth is I have dabbled with it on and off for years, but time and again found myself returning to pen and paper or my own never-fully-developed structured text format for my note-taking needs. This summer I came back to org to try one more time to grok it and make it my one true text format, and I think this time it's for keeps.
Learning to use the agenda and global to-do views were the first two things that improved my org experience. Those are rather obvious though, so I didn't intend to blog about them. Customizing the way to-do items work was the latest, and getting that just right involved a bit of research, not only reading the docs, but also the source code, and getting some help from those who have gone this way before.
The way I think about a to-do item is like this. I want to keep a full log of my progress with any given item. That means I want to notate not only when I completed the item (which org does by default) but I also want a record of when I created the item, and also records of each point of progress. Here is what I came up with:
(setq org-todo-keywords
'((sequence "TODO(t!)" "|" "DONE(d!)" "CANCELLED(c!)")))
(setq org-treat-insert-todo-heading-as-state-change t
org-log-states-order-reversed nil
org-log-into-drawer t
org-log-done nil)
(eval-after-load 'org
'(setcdr (assq 'state org-log-note-headings)
"State -> %s %t"))
Let's just run down these variables one by one.
-
org-todo-keywords
I have configured three states, TODO, DONE, and CANCELLED. The pipe delimits incompleted states on the left from completed states on the right. With each state, I have given in parens a fast access key for use with
C-c C-t
and the exclamation mark which signifies to always log the change when changing to this state. -
org-treat-insert-todo-heading-as-state-change
A true value means that creating a to-do entry will trigger logging of a state change.
-
org-log-states-order-reversed
A value of nil means that state changes will be logged in chronological order, from top to bottom.
-
org-log-into-drawer
State changes will be logged into a drawer called
:LOGBOOK:
. One can give a string value for this variable to change the name of the drawer, but the default is fine by me. -
org-log-done
The nil value here turns off org's normal behavior of inserting the
CLOSED: [timestamp]
line when an item is marked with a completed state. I don't want that line because I have already specified withorg-todo-keywords
that all state changes are logged into a drawer. -
org-log-note-headings
This complex little form just defines the format for the state change log entries.
So there you have it, my org to-do config. It allows me to keep a
detailed record of my progress with to-do items. There are further tweaks
that could be made to org-todo-keywords
to improve it more,
specifically, using the @
flag and the /
special syntax, but what I
have already may be good enough. I will conclude this entry with an
example, showing what a completed to-do entry looks like in this
configuration.
* DONE blog about org to-do config
:LOGBOOK:
- State -> "TODO" [2011-09-28 Wed]
- State -> "DONE" [2011-09-28 Wed]
:END:
It works!