Cross-Pollination

June 29th, 2006  |  Published in etc

I’ve been living the mutt life the past week or so, but I found myself really missing the single-keystroke mail-filing I had with Mail Act-On.

A while back I set up some macros for auto-filing mail in mutt using output from the date command to generate a date-stamped folder, but they were using the “.xx” format of command you see around a lot of muttrcs.

These lines give me Mail Act-On’s `-x keys, and do the same thing:

file in work, personal or receipts

macro index `w "<save-message>=work_date +%m%y<return>"

macro pager `w "<save-message>=work_date +%m%y<return>"

macro index `p "<save-message>=personal_date +%m%y<return>"

macro pager `p "<save-message>=personal_date +%m%y<return>"

macro index `r "<save-message>=receipts_etc<return>"

macro pager `r "<save-message>=receipts_etc<return>"

macro index `t "<save-message>=todo<return>"

macro pager `t "<save-message>=todo<return>"

macro index `a "<save-message>=toanswer<return>"

macro pager `a "<save-message>=toanswer<return>"

It’s been kind of interesting using mutt, Emacs and Firefox more under OS X. I was initially sort of dismayed at the prospect of losing a lot of the functionality I’d built for myself with AppleScript, since none of those apps are particularly scriptable that way. But a few things have become apparent:

  1. Automator encourages thinking of workflows in terms of piping stuff around. At least, if it isn’t encouraging it, it rewards thinking in classically Unixy terms about automating stuff. “This goes here and comes out like this and gets fed into here.”

  2. If you’ve been writing pipes all along for whatever reason, it’s usually pretty easy to rip out one piece of the pipeline that’s dependent on a scriptable app and replace it with a bit of shell script that does the same thing.

  3. Good programmers in the Mac space show a lot of care for making sure your stuff is retrievable, and not locked up in some useless format. VoodooPad’s an exemplar in this regard. I’ve thought about replacing it now and then with some Emacs stuff, but I never really see the need: It’s very functional and rich in its native file format, but Gus made sure to make it pretty easy to get stuff out of a VoodooPad document in a variety of more or less universal formats. He’s even kind of nice to the Word people, who I’ve always assumed are the last to worry about lock-in of any sort.

I got to thinking about a lot of this stuff in the wake of the Pilgrim/Gruber exchange, amply linked by Ed, not so much because I’m in a blind panic about “Apple’s proprietary file formats,” but more because I realized that when I come across a problem I can’t solve with Applescript, I’ve probably started typing a line like do shell script before I even realize it.

Someday, if I don’t have a Mac in the house anymore, I probably won’t be able to pop open Emacs and reflexively type do applescript to make some bit of bash scripting tick. So rather than becoming dependent on a workflow that’s heavily flavored by a single platform, I’d rather spend my time figuring out workflows I’m more likely to carry off on several platforms.

So I’ve spent some time this week refactoring scripts I’ve written so that the Apple-dependent part is the kind of stuff that makes sense in the current context: How do I launch this particular script? How do I get this thing in the clipboard into the pipe? Do I trust this app enough to keep using it, or is it pretty dispensable and is there a more universal option available?

In the end, I’m looking for an A-to-D pipe where A & D are perhaps OS-dependent (what goes in, where it comes out) but B&C — the parts that are more properly thought of as the logic and processing bits — are anchored in what I think of as a more universal environment I can take anywhere. And the pre-made tools I want to use are the same: Things I know I can find or build on just about any platform, and where the all-important configuration files can be zipped up and plopped down elsewhere and expected to just work.

All that said, just dropping Macs seems too drastic. The thing I think is really wonderful about OS X (even if Gruber calls people who adopted Macs after its advent ‘carpetbaggers’) is its ability to create tools in a classically interoperable mode. It’s not as awkward or graceless as it is in Windows to get a Unix toolset going, but the polish at levels above that basic toolset is more pronounced than it is in Linux or the other BSDs.

Leave a Response

© Michael Hall, licensed under a Creative Commons Attribution-ShareAlike 3.0 United States license.