mutt query gmail

mutt’s query_command is nice. And using gmail to archive all my mail is nice too. Managing mutt’s address book (flat text file) is somewhat annoying though.

Wouldn’t it be better if mutt could use gmail as an address book? Yeah, I thought so too.

To make this all work, you’ll need 2 things. The following instructions assume you know how to download and patch stuff.

First, download and install libgmail. Verify it works.

Then, stick the mutt_gmail_search script somewhere in your $PATH.

You will need to add the following to your .muttrc:

set query_command="mutt_gmail_search '%s'"

Now you can continue to use mutt as a front-end, gmail as your archiving back-end, and avoid having to manage your mutt address book. Enjoy!

edit: on 26 March 2008 — no longer need my patch against libgmail as it’s been accepted upstream; moved mutt_gmail_search to git repo


This is a collection of scripts to manage your music tracks from within iTunes. If you have an album whose tracks have incomplete or missing tag information, these scripts can:

  • pull information from
  • add the id3 tag information to the album’s tracks

These scripts will only work on a Mac, since AppleScript is involved.

First, I assume that you know your way around a unix shell (aka the terminal). If you don’t, I apologize for the seemingly terse documentation. Perhaps someone else out there in internet-landia can write some more user-friendly instructions.

Next, a prerequisite. You will need to download and install rb-appscript.

After you have accomplished that task, go ahead and download RuFF iTunes. You will need to copy both AppleScript files to your iTunes script library, typically located in:


Finally, you will need to copy itunes_freedb.rb to /opt/local/bin.

You may want to restart iTunes just for kicks.

This is not the world’s simplest workflow, but it does work, and sure beats typing all the data into iTunes manually, so bear with me.

First, you need to select all the tracks in the album for which you are interested in normalizing.

Caveat: we assume that the tracks in the album are in numerical order! If they are not, I do not recommend running this script, as I’ve not tested what happens in this case.

Next, create a playlist with those tracks. This can be accomplished by the key combination: control-shift-n

Select the playlist, then select the first track in the playlist.

Select the Firefox Search Freedb menu item, from the script icon in the iTunes menu bar. You will be prompted on a field to search on.

Firefox will then search for the track information. This step is where human intervention is necessary. Click around until you find the album which seems to match up with the tracks you have in your iTunes library. On the line that says “Disc-ID”, there is a link to a funny looking combination of letters and numbers.

Copy that link location to the clipboard.

Return to iTunes, and select the other script from the iTunes menu bar, called Save Freedb Results. Paste the URL you just copied into the entry box. If all goes well, your tracks will be renamed, and any additional information, such as Year and Genre will be added, if available.

Are you kidding me? Look at how long and complicated the install and usage sections are. This is due to the fact that I just wanted a quick and dirty solution for myself, and I’m willing to live with quite a bit of ugliness in my life.

Seriously though, my set of scripts was based heavily upon the
CDDB Safari Kit written by Doug Adams, and that kit is the basis for the two-step AppleScript ugliness. I alone am responsible for adding the third ugly step.

If I were to spend more time improving this, I’d probably think about:

  • writing better documentation
  • making some sort of installer
  • including the rb-appscript package with my package
  • adding error checking
  • giving the user an option to choose which web browser to use
  • removing the requirement that tracks must be in album order (probably would work if you at least had the track names, but in alphabetical order and were missing track number information)
  • making the installation location of itunes_freedb.rb configurable

Improvements are welcomed.

This set of three scripts is released under the GPL v2 and comes as-is. No warranties are expressed or implied.

I’ve tested it on my machine, and it works, but no guarantees that it will work on yours. Please don’t come crying to me if these scripts erase all your music and your mac blows up and you start getting tons of crazy spam (not so bad) but you actually start reading it all (pretty darn bad).