Emacs todo-list-mode

Although it wasn’t on my todo-list, I really had a hankering to add some auto-color highlighting to mine. So I created a pretty basic major-mode for Emacs which I call todo-list-mode. My list is just a plain text file that I can sort the lines based on the assigned number in the first column. I created a few regexp’s to pick out these and change the formatting based on priority. It’s pretty simple and easy to extend, so if you want to add more numbers or change the colors — go nuts. It also supports hash style comments to tack on the end of a line.

Grab it: todo-list-mode.el

My current todo-list.

To include this mode automatically, add to your .emacs :

(add-to-list 'load-path "~/emacs/lisp/") ;my lisp dir
(autoload 'todo-list-mode "todo-list-mode") ;load when needed
 
;a simple function that opens the file,
;and switches to todo-list-mode.
(defun open-todo-list ()
  (interactive)
  (find-file "~/notes/TODO")
  (todo-list-mode))
 
;then bind to control-f12 so i can call it with one keystroke
;this works well for me because i also bind calendar to f12
(global-set-key [C-f12] 'open-todo-list)

The format for a given line is:
number (0-4), [optional lower case letter], [TAB], task text.

If you want to add more numbers, change the colors, or change the delimiter, it’s fairly easy to open up the elisp file and do a little copying and pasting.

To sort I just use some standard Emacs commands;
Select a region (C-x h for entire buffer), then M-x sort-lines .
To note, the regular expression that does the coloring looks for a tab delineator between the priority number and the task text. If you’d rather not use tabs you’ll have to change it to a couple of spaces or something.

This style works for me because I really need something minimal and easy to access if I’m going to use it. Sure there’s org-mode and other more complicated variants but I need simplicity. There’s too many other things to worry about that I can’t justify spending extra brain activity trying to operate a todo list. This ordering system is something I got from Randy Pausch, which is based on Stephen Covey’s quadrant system.

It’s a little weird to post my current todo-list (well maybe guide is more accurate), but I haven’t posted in a while and maybe some of you are wondering where the heck I’ve been. Busy, busy, but it’s winter so I’m spending the time in the lab and concocting all sorts of new experiments. Hopefully by spring I’ll be ready to start putting some of this stuff together.

Posted on January 17, 2009

Tags: