Gmail add-ons for the lazy hacker

27 April 2009

I have a nasty tendency to put off email replies, preferring to batch them up rather than inline-respond. People I've worked with have on occasion mentioned that this is, “an excellent productivity tool,” as avoiding immediate replies is a fair method for maintaining mental state, but I know better; sometimes, I'm just not in the mood.

Trouble is, it's easy to forget to reply to messages after a few days have passed (my dear, poor family). In the corporate world, you can pop a few Outlook reply windows and work your way through your taskbar, but civilian life in Gmail doesn't really afford this luxury.

Sure, they've got a Task List feature in Labs, but there's so much click here, click there, is it really worth it? What I'm looking for is a way to mark a Gmail message as worthy of reply, then have it auto-remove itself from the reply queue once I've taken care of it.

Enter GUnmarker

Fortunately, Gmail's label system is already pretty robust. You can “tag” a message as meriting response (through an appropriate label), and then delabel it once you've replied.

Still, that's two clicks too many as far as I'm concerned. I want to click Send and just forget about the entire incident. A little bit of Javascript with a sprinkle of DOM flavor can solve this pretty simply. So here's the deal:

It's been tested in FF3, and mostly works. If you want to patch it for your browser, feel free; I'll happily upload better code. The action mechanism is essentially a global variable which monitors changes in the URL hash (using 300ms timeouts, at present). Once it senses an email, it binds onclick listeners to all the appropriate places and, when a reply is sent, removes the label specified by my_label_name (or “for-reply”, if no overriding label is specified).

There is no promise that this will function with and/or not break any other Gmail add-ons. Fortunately, the fix is a mere page refresh away, so I declare it sufficiently not risky.

I don't expect you to necessarily trust third-party Javascript running on your email inbox, so I invite you to read and/or copy the source code from I'm not specifying a license because, frankly, who cares.

Update: v2 makes some notable improvements; instead of constantly traversing the DOM, GUnmarker now monitors the URL hash and only checks the DOM structure when necessary. This fixes the newer and older problem, and reduces CPU load significantly. It also looks like it's reducing overall memory consumption (likely due to circular, orphaned objects), so that's a good change.

Still, the 300ms timeout method is a little grating, as it means that there's some requirement that the user not click on things immediately (which, fortunately, is generally a reliable assumption). And there's the fact that there is more than one way to reply to a message, including Reply All. More work to be done.

Included \(\LaTeX\) graphics are generated at LaTeX to png or by MathJax.

contemporary entries


This is awesome; I've always wanted something like this. Will have to give it a try.
bryan (27 April 2009, 10:54pm)

Sorry, further commenting on this post has been disabled. For more information, contact me.