These things come in waves

In the past, when I’ve gone through a plaintext or Emacs kick of some kind, I’ve blown past what I’ve come to think of as a common sense limit: Eventually I’m looking at Wanderlust, GNUS, or mu4e and thinking about the whole email in Emacs thing. Inevitably, then, you’re looking at some sort of way to sync your IMAP account down to your local machine, and a whole layer goes in to make that work.

I walked up to the line this time around, asked myself what problem I’m trying to solve, and remembered that part of what is making Doom Emacs work for me right now is how much I’ve been keeping things limited to stuff that has to do with writing and stuff that has to do with personal organization. Those are things that don’t stress Emacs’ single-threaded nature the way I do them, and that don’t take me into the murky space between Emacs and the OS.

The problem I am trying to solve whenever I go on these kicks, is the pain of getting parts of the macOS experience into a more keyboard-centric place. Mail always sticks out because I don’t like doing Mac Mail from the keyboard. There’s Mail Act-On, but at $45 a renewal it’s just more than I can see paying, and it doesn’t really do much for visualization – it just makes it easy to move things into folders.

So my mind always goes to mutt. It’s not perfect – search is a challenge without something external augmenting it – but I’m not sure it matters in the end: I use Fastmail for IMAP, and I don’t mind punting to its web interface if I need to go dig for something.

I thought about mutt this time because my long-standing config has always sort of felt similar to the way Spacemacs and Doom put a modal UI over Emacs. My mutt macros – here’s a sample – use . as a leader and are written mnemonically:

macro index .sn "l ^a^k~N\n" # Show unread/new only
macro index .sa "l ^a^kall\n" # show all
macro index .C "<esc>V" # toggle threads
macro index .si "l (~n5-100|~N)\n" # show interesting 
macro index .rs "<enter-command>source ~/.mutt/scores<enter>" # reprocess scores
macro index .sf "l ~F\n" # show flagged
macro index .hl "l ^a^k!~l\n" # hide lists
macro index .to "T ~d>7d\n" # "tag old" -- messages older than 7 days
macro index .ab    "<pipe-entry>/opt/homebrew/bin/lbdb-fetchaddr\n"                # Store address details in lbdb.

The value of mutt is less as my everything email client – I still keep up with mail from my phone or tablet – and more because over the years I’ve tuned it to visualize and process mail from the keyboard. I still read mail with my phone or tablet every day, but don’t like to do anything more than flag messages when I’m out.

HTML mail and mutt

mutt is sometimes hard to stick with because we lost the plaintext email battle. I know one designer who formats his email with monotype faces in what I’d describe as a sort of problematic aesthetic revolt, but otherwise … we lost and we’ll never be able to unsee Calibri.

Sticking elinks, lynx or w3m in your ~/.mailcap to show HTML was best practice for a long while, provided you didn’t mind also using urlview to display the links in a message once you’d read it. I was involved in email marketing during the era when that approach worked, partially because to do HTML mail “right” back then meant you had someone doing it painstakingly by hand, then reviewing across a multitude of clients and platforms – you were heavily incentivized to keep it simple. I bear the scars from a spat with a division of Siemens that was still using an old Lotus Notes and Win2000 in its marketing department. They were the customer, and the mail didn’t look good to them, so it didn’t look good. That was all, and we were forced to buy the next tier of service from our mail provider so we could add Lotus Notes on Win 2000 to our testing.

Anyhow, “elinks in your mailcap and call it a day” doesn’t work anymore: image text, dozens of links, complex positional markup, etc. etc. etc. and it makes a lot of HTML mail a hash in a plaintext browser. There are a few ways to solve this on a Mac: One is punting to an actual browser, and the other is using the Mac Quicklook service:

text/html;  open -a firefox %s; nametemplate=%s.html text/html; open -a firefox %s; nametemplate=%s.html; copiousoutput
text/html; qlmanage -p %s; nametemplate=%s.html

The former does about what you’d expect from looking at it: It uses Firefox (or whatever browser you’d care to invoke) to open the HTML part of the message, at which point you can click links, etc.

The latter is a little more obscure, but basically recreates what happens when you select a file and tap the spacebar to preview it on a Mac, popping up a modal window with the contents. This often works well for other kinds of attachments. With HTML mail it is enough to let you read the mail but not really interact with it (e.g. follow a link). The [DEBUG] label at the front of the modal’s title suggests that nobody at Apple really took the “plain text zealots using this to browse HTML email” use case into account when they wrote qlmanage, and the man page makes clear it’s just a debugging tool. It’ll do if you never intend to interact with a mail.

I’m sticking to the Firefox approach. It’s super fast if Firefox is already running (it always is), and you can follow links.

These things leave in waves, too

At some point mutt is going to do something to annoy me. I don’t know what it’s going to be this time. For now, I’m just enjoying the periodic dustoff of my config and pleasures of zipping through my inbox. If I had to guess, it’ll have something to do with getting email messages into org-mode or calendaring, somehow. There are a few shell-based CalDav clients out there, but they’re very sync-and-cache oriented and I just don’t like adding services. Had mutt never added IMAP caching and built-in SMTP support, I would have a harder time justifying it.

But I feel more protective of my Emacs and org-mode experience than anything. This run with Doom has yielded the most stable Emacs experience I’ve had since switching to Macs mooostly full-time ca. 2004. No mystery segfaults. No hard-locking the UI because I have IMAP, RSS, IRC, and Twitter clients running in my text editor.