Sunday, August 16, 2009

Omnifocus Quick Entry from Emacs

I'm in the process of transitioning from an emacs org-mode personal productivity workflow over to Omnifocus. A friend turned me on to Omnifocus earlier this week, and after watching the two screencasts (1, 2)of how to use it to implement the "Getting Things Done" workflow, I decided it is worth the investment to move to Omnifocus.

Current System:
My current system is a bare-bones version of GTD using simple text-files organized into directories on my local hard drive. To get version control and backup I have put the root of my system into a git repository and use the $7/month plan on github to keep a private backup. This is far from ideal, because I find myself committing changes and pushing to github happening only about once a month. Yes, I could have created a cron job to do this for me automatically, but I never got around to it.

Switching to OmniFocus
I won't go into the details of why OmniFocus is better, but I'm fairly confident that if you have spent any significant amount of time working on or reading about personal productivity, you will find OmniFocus pretty compelling if you spend an hour learning about how it works. It is $80, but I figure if I cancel my github account, it will pay itself off in less than a year.

Migrating from Emacs.
I wanted to efficiently go through line-by-line and enter items from my emacs buffer into OmniFocus using the Quick Entry popup. I found a nifty snippet of elisp that automatically put the full buffer's contents into the OmniFocus inbox. This was a good starting point, but what I really wanted was a way to put just a selected region into the Quick Entry window so I could easily set all of the action's properties right there. Being an elisp newbie, it took a little while to figure it out, but copying this into your .emacs should do the trick and allow ctrl-c-o to invoke the Quick Entry window with the current region:

You can also see it in a much easier to read form here at pastie.



(defun omniQuickEntry (beg end)
(interactive "r")
(do-applescript (concat
"tell front document of application \"OmniFocus\"
tell quick entry
make new inbox task with properties {name:\""
(buffer-substring beg end) "\"}
activate
select {inbox task 1}
end tell
end tell")
))

(global-set-key "\C-cq" 'omniQuickEntry)