Monday, February 15, 2010

Org-ing in Emacs

I have been using emacs since the beginning of computer time, way back in the mid-80s. My .emacs file has been carried around for almost as long. Each major rev causes me headaches, as I never know what archaic options are going to break things. And yet, I'm still learning new things to do with it. I think it inspired Zawinski's Law of Software Envelopment:



Every program attempts to expand until it can read mail. Those programs which cannot so expand are replaced by ones which can.


My latest Emacs discovery was on an Arch Linux forum thread on note taking software. I use Remember The Milk for plenty of lists, but the web based nature of it makes it hard to be quick about doing a quick note. I started keeping a simple text file with notes on what I was doing, as I was finding whole hours at the keyboard disappearing into a black hole. I whipped up a quick Emacs macro that I bound to F7, which opened a file to prepend a new quick entry:



(setq logfile-name "/home/jdarnold/Dropbox/dailylog.txt")
(defun insert-new-log ()
"Start a new log entry"
(interactive)
(find-file logfile-name)
(beginning-of-buffer)
(insert "==== ")
(insert-now)
(insert "\n\n")
(previous-line)
)


As you can see, I put the file in my Dropbox folder (use this link to sign up and we both get an extra 250gb of storage space), so no matter which computer I'm working on, I can jot a quick note that looks something like this:



==== Monday, January 25 2010 10:43 AM (1264434222)
after a couple of hours puttering around, including writing a review
for Goodreads, I'm back at work. Trying to figure out what I did to
break the video plugin
#insors


I have a few adhoc tags, stamp it with time date and Unix time, and tried to see what I was working. It's okay, but if I forgot to jot something down when I left the keyboard (which I often did), it lost a lot of its effectiveness.



Then I found out about org-mode in Emacs. It's been in the standard Emacs distribution for a couple of releases, but I'd never heard of it before. And wow, is it amazing! The PDF of the User Manual is nearly 200 pages! And it really does everything you could want in an organizer/todo manager/note taker. It even has a clock in/clock out/idle timeout paradigm, so it can notice when I've walked away from my computer. Unfortuantely, "real" idle only works on Mac OSX and Linux (after compiling x11dle.c). On Windows, it just notices when you are idle in Emacs, which, despite the fact I use Emacs alot on Windows, isn't quite the same thing.



So now I've changed my Emacs checkin macro to be:



(defun start-new-task ()
"Start new journal task"
(interactive)
(find-file (concat dropbox-folder "org/" journalname))
(end-of-buffer)
(org-insert-heading)
(org-clock-in)
)


so it adds a new heading and starts the clock. And on my work machine, I set journalname to be a work journal and on my personal machine, I give it a different name. Still working out the kinks in the process, but it's closer to tracking what I've been doing.



I also intend on using org-mode to jot down my myriad project ideas. I'm always coming across interesting web sites, esp. for web APIs, that make me want to dabble in some projects, but I've never had anywhere to jot them down. I was using MindMeister.com, an online mind-mapping tool for it, but found it too structured. Given org-mode's flexibility, I should be able to find some easy way to just add my "brilliant" brainstorms to a file!



No comments:

Post a Comment