Caching Additional Headers in Mutt

When searching/limiting mesages, Mutt provides several built-in fast patterns for common headers such as From, To, Cc, References, and Message-ID. For less common headers, it provides the fallback ~h pattern, but this is much slower. (And completely unusable over IMAP: for that you're better off using server-side searches with =h).

Sometimes you commonly search for one particular header over and over, or would like to see that header listed in the index. This post describes a hack you can use to do this quickly, using the spam detection built into Mutt.

For this article, let's say you commonly search for a header called "Importance" and would also like to see the value of this header in your index.

If you are using IMAP, the first thing you need to do is add the header to the $imap_headers setting (note it must be uppercased):

set imap_headers="IMPORTANCE"

Next, you use the spam command to match the header and record its value:

spam "^importance:\\s*(.*)" "%1"

This takes the raw value of the header, but of course you could do your own transformation:

# Your own flags:
spam "^importance:\\s*high" "!"
# Or just the first letter:
spam "^importance:\\s*(.)" "%1"

Once you've done this you can now use the ~H pattern to search/limit against it, and the %H format string to display the value in your index. Even better, these values are cached in the memory, along with the from/to/cc/subject so searches are fast.

posted: Jul 3 2016
tags: mutt

Enabling eshell smart display mode

After reading Eschewing Zshell for Emacs Shell and Mastering Eshell I've been trying out the eshell a bit more.

One thing both recommended was the "smart display" mode, however I found the instructions for enabling it didn't work for me. Maybe something changed between versions.

In any case, to make it work, I had to put eshell-smart-initialize in my eshell-mode-hook:

(add-hook 'eshell-mode-hook
  (lambda ()
posted: Jun 5 2016
tags: emacs

Oh... I have a blog

I guess I should admit this has become a semiannual blog. Perhaps if I made it more convenient, I might post more. Or perhaps I'm just lazy and don't like writing much.

Liven and I took a cruise to Alaska! I almost had the chance to meet David Champion in Seattle before the trip, but our schedules didn't quite match.

Also, since I've last posted, I've released mutt 1.6.0 and 1.6.1, with 1.6.2 to come out soon. I guess that's been going pretty well.

Just today, I committed the neomutt version of the sidebar patch. Yup… no kidding. I don't know if I'll end up using it much, but many people say they can't use mutt without it. It needed some cleanup, (and still needs more) but the mutt_window changes made it less invasive than it was. After the buffy fixups, it will be time to start thinking about 1.7.0.

A lot can change in 6 months. Since last post, I've pretty much fully switched over to using emacs as my editor. It's taken some adjustment, but overall I like it. It's more… relaxing to use. Yup, vim kicks some major butt when it comes to cursor and object manipulation, but I found using it all the time tiresome. I still use it for 3-way-merge (using splice) and for reviewing patches, but otherwise I'm trying to use emacs for everything. I wish I had earlier.

posted: Jun 4 2016
tags: mutt life

Recent mutt progress

Wow, it has been a long time since I posted to my blog. The good news is I've been busy. Let's see, to start, I released mutt 1.5.24 back in September. For my first release, it went pretty smoothly, although Brendan ended up having the mail the announcement out.

After a few emails, David Champion and I decided the next release should be 1.6.0. At this point, I'm not sure how much excitement that will generate, 1.5 being de-facto stable, but nonetheless it's long overdue, and I am excited. So I've been working through the 1.6 tagged bugs, and starting to review external patches. The current plan is February or March.

I spent all of September and October in Taiwan. Usually I have plenty of time to work on the computer, but this trip we planned a lot of activities, including a trip to Japan.

Recently, I tried out spacemacs. My first impression was pretty good. I've always wanted to try to learn more emacs, but every time I've given up pretty quickly: after using vim for 20+ years, it's just hard to start over, and I'm pretty productive in vim. Unfortunately, even though I liked spacemacs, I found it really easy to lock up just by scrolling the cursor. Some things in evil mode worked differently enough from vim that I found myself annoyed sometimes, but the lockups were the deal breaker.

Still, since then I have tried once again to start learning more emacs (using my own .emacs config). I'm using it to write this blog post, and have been doing some small stuff in it. We'll see.

The past year, after reading Marie Kondo's "The Life-Changing Magic of Tidying Up: The Japanese Art of Decluttering and Organizing", I have worked on reducing the amount of things in my life. The book isn't about minimalism, it's about removing things that don't "spark joy", as Marie says. I found her ideas and stories in the book made a lot of sense to me. While my environment now isn't perfect, it is far better than it has ever been before and I feel happier working in my study at home. If you feel you have just too much stuff, I highly recommend keeping an open mind and reading this book.

Well, that's enough for now. I'll try to post again before the 1.6.0 release with an update.

posted: Dec 17 2015
tags: mutt life

Opportunistic encrypt committed

Yesterday, I got approval to push my opportunistic encrypt patch series to the mutt repository. I've been working on this series for quite a while, so it's great to finally have it available for others to test and use. If it's something that interests you, please try out the latest version in hg!

posted: Apr 1 2015
tags: mutt

Moving everything over to FastMail

Over the past couple years, FastMail has made some pretty major improvements to everything. They've added a very nice Calendar, which can even pull and push data to my Google Calendar. They've souped up their web email interface with a modern interface complete with keybindings. (I spend most of my time in mutt, but it's nice to use the web interface for some things.)

Just recently, they've released a beta for a CardDAV interface to their contacts. This allows me to use a program like pyCardDAV to sync my contacts locally and query them from lbdb/mutt.

In the mean time, all the Google tools seem to get slower and slower. Loading up Gmail downloads about 5+MB of crap for their chat tool, Plus interfaces, and who knows what else. It takes about 20-30 seconds for it to stop downloading after it loads up!

They also continue their path of integrating everything into Google Plus, and since I don't really use that it's just a huge aggravation. Since it's free (of charge), I don't have much standing to complain.

However, I can choose to use something else, and so that's what I am doing. I've started moving everything over to my FastMail email address (this domain's). I'm not closing down the gmail address, but it's definitely deprecated. I've spent the last 10 years dividing my time between the two email addresses, and it feels good to finally be able to use one account for everything.

So long, Gmail!

posted: Apr 1 2015

A month as a committer

Life as a new committer on the mutt development team has been busy but wonderful! I've gone through all my old patches and tickets, and (one by one) re-tested them and pushed them up to the repository.

I have also tried to make an effort to go through some of the patches posted by others and commit the ones I'm comfortable with.

There is still a lot I want to do, but it feels great to have all these fixes and new features in there, and for development to be moving again. The rest of the committers have been very supportive, giving me feedback and advice when I need it.

Recently, I've even been revamping my opportunistic encrypt patch set, with the feedback received from last time. It's a big series, but I'm hopeful I'll be able to get that in. In the mean time, I've posted the patches up on my website.

posted: Feb 8 2015
tags: mutt

Joined the mutt committer team

I'm excited to announce that the mutt team has welcomed me as a committer! It will be great to be able to directly contribute to making the project better and more vibrant. I've been dancing on the ceiling all day…

posted: Dec 18 2014
tags: mutt

Development since last post

Wow it's been 4 months since my last post. I spent all of October in Taiwan, but still…

First off, I released a new goobook Debian package for jessie today. The latest python-setuptools no longer includes "distribute", so goobook was erroring out. Since this isn't needed for the Debian package, I removed it.

On the mutt side, the mutt-dev mailing list came to life while I was in Taiwan. They released mutt 1.5.22 with one of my commits: 2788 - pager quit.

Afterwards, the floodgates opened (for a little bit) and several more of my patches were committed:
3070 - Mail-Followup-To header on postpone+resume
3083 - save attachments fix
3644 - segmentation fault when viewing an application/x-sh attachment

I still have patches for these open:
3082 - input history preserve
3564 - empty gpg uid fix
3478 - gpg signature filename
3580 - -H ignores recipient arguments on CLI
3665 - encrypting postponed messages

My opportunistic encrypt series got a few more comments and I made a small revision, but I don't think it's likely that will go in. That's okay, because I've rolled my own version with all these patches applied and am using that now (something I admittedly should have done a while ago). But at least now I'm using my own patches to give them some testing.

posted: Dec 10 2013
tags: debian goobook mutt

New goobook packages

This past weekend, version 1.5 of goobook was released. The changes were very minor, mostly supporting a newer version of hcsutils and dropping support for python 2.6.

I have uploaded new Wheezy packages to my website. You'll need to update python-hcsutils to the 1.3 version for goobook 1.5. The goobook 1.4 packages are still there though and should still work just fine.

posted: Aug 12 2013
tags: debian goobook

Page 1 of 4 Next page