Hobby-hacking Eric


getting things done with mutt

Edit 2007-10-29: a reader asked me to add the gtd and mutt tags to this article. Thought I might take advantage of the situation to tidy up the article a little.

You've probably heard about Getting Things Done (GTD) and lifehacks by now. If not, it provides a simple, but non-obvious algorithm for human beings to stay on top of things in a stress-free and effortless manner. My implementation of the GTD spec is working pretty well, but it has one huge, gaping hole: e-mail. The following is a collection ideas for plugging the hole and adapting my favourite mail client, mutt, to be more GTD friendly.

basic next action labeling (X-Label)

My mail processing workflow is GTD inspired -- interestingly queues work better for email whereas stacks work better for real life -- but one major flaw is that when I save a message to =ACTION. The problem is that I was using paper to write my actions down. Paper's great, but it's not very convenient for something which is inherently computer-based (it means dragging my notebook out of my backpack, for example). What I needed was some way to associate email messages with actions.

Fortunately, a fellow mutt user has made a small patch to add an onboard X-Label editor to mutt. This is almost perfect for annotating messages with Next Actions and Waiting Fors. It does not compile against the mutt [1.5.13] that's in MacPorts, but I have updated the patch and Portfile so that it does. I will put it on the web if somebody's interested.

The following should go into your muttrc, so that to set a next-action, you simply hit 'y':

bind pager y edit-label
bind index y edit-label

To make this more useful, I also add the following white on red highlighting so that the next action is the most visible part of the message:

color header white red "^X-Label:"

Filing to =ACTION (user-input)

I currently have the following set in my muttrc so that Ctrl-A saves the current message in =ACTION and Ctrl-W saves it in =WAITING (=WAITING is problematic, a bit of a black hole).
macro index \Ca "<save-message>=ACTION"
macro pager \Ca "<save-message>=ACTION"
macro index \Cw "<save-message>=WAITING"
macro pager \Cw "<save-message>=WAITING"

What I would like to do is script it just a little bit more so that Ctrl-a asks me what the next action is, and then saves it in =ACTION. What I need is a mutt feature (maybe it already exists) which I call <user-input> (which basically means, wait for the user to type something and hit enter). Then I can extend my macros like so (pager ommited):
macro index \Ca "<edit-label><user-input><save-message>=ACTION"
macro index \Cw "<edit-label>WF: <user-input><save-message>=WAITING"

I guess saving a couple of keystrokes isn't that big a deal. I could just have a workflow where first I hit 'y', plug in my next action, and then I hit 'Ctrl-a' (this is what I do now). But it would be nice if this was enforced by my keybindings. Note that in order for this not to be horribly irritating, the macro system should stop processing the macro if the user hits 'Ctrl-c'. In other words, if I change my mind about setting a next action, it should just stop there and not file my mail for me automatically (which would mean I'd have to fish it out, etc)

Next Action counter

One thing I would like to have whenever I'm looking at my mail is to have a small, discreet counter telling me how many next actions and waiting fors I have. You know that bar on the bottom of the screen in mutt? That's where I'd put it, on the right. ----- Actions: 9 WF: 15 ----. A little reminder like that would be great!

Next Action preview

Another thing which might be useful is to be able to 'preview' a message, but only showing its next action. When i'm in index mode of mutt, for example, below that bar on the bottom of the screen, I would like to have one line showing me the value of the X-Label.

that's all!

That's all I have for now. Please comment if you have any other ideas or mutt-gtd tips.


kowey said...

Crap... I just realised that this doesn't remember the labels unless you save the message somewhere. So if you edit a label with 'y', you should save it back to same mailbox lest it be forgotten.

Nick said...

I'd definitely appreciate that patch against 1.5.13 and the Makefile for the port as well!

kowey said...

Here's a temporary place you can download it from.

Hez said...

Do you know what if there is a way to have the changes stick without saving the messages? It's too bad that doesn't work as-is since this is an otherwise excellent addition to mutt.

Thanks for the cleaning up of the patch!

kowey said...

Hez, Unfortunately not. Sometimes it trips me up, but most of the time, I manage to remember. Would be nice if it was instantaneous, though. It might be worth asking the original author about it.

Anonymous said...


these are very nice ideas you've collected here. I was about to patch my Mutt when I stumbled across an editor for X-Labels that was realized as an external script. I adapted that to be more GTD-friendly. You can get it and a small description including a link to the original here: editlabel for GTD

kowey said...

Nice! I haven't had time to try it out, but in principle I like the idea of not patching mutt :-)

kowey said...

Some additional ideas/implementation:

navi said...

Please add “gtd” and “mutt” tags to this post

kowey said...

Done, thanks.