How I use Thunderbird to Write Emails and Review Patches

Regardless of how one might feel about patches-over-email software development, the reality is that a lot of exciting open source projects are developed on mailing lists. Configuring a pleasant plaintext-oriented e-mail environment may not be obvious for those of us who come from a primarily git forge style background. At least, it wasn’t for me. In any case, I’ve finally arrived at a productive setup and I’d like to write it down here for posterity.

Note: This is not a guide to sending git patches with Thunderbird. I use git-send-email(1) exclusively for that.

Initial Configuration

The first thing I do after installing Thunderbird is apply Linux kernel’s recommended settings. After that, I select “Edit” > “Account Settings” and modify the following:

  • “Copies and Folders” tab: Select “Place replies in the folder of the message being replied to”
  • “Composition & Addressing” tab: De-select “compose messages in HTML format; and for the “When quoting,” dropdown menu, select “start my reply below the quote”

Note: As of this writing, the recommended “exteditor” Thunderbird addon is not compatible with the latest version of Thunderbird. I describe how I cope with this later on in the post.

Reviewing Patches

For a one-time setup, install the Colored Diffs Thunderbird addon. It will apply git-diff coloring to email messages if it detects a diff in the body of the message.

Depending on the scope of the change, I may choose to review the patch exclusively within Thunderbird by reading the diff, or I may choose to apply the patches locally to my git tree to play around with them. The aforementioned Colored Diffs addon makes the former much more pleasant.

If there’s just a few patches, I might open a terminal window and navigate to my git tree. Once I’ve done that, I’ll right-click the first patch > Select “Copy to Clipboard” > Select “Message”. Then I can apply the patch:

$ git am -
<PASTE>
^D

I’ll repeat that for each patch.

This doesn’t scale well for more than 2 to 3 patches though. If there are multiple patches, I will select each patch and then right-click > “Save selected messages” > “As mbox file (new)” > Save. Then, in a terminal window, I can navigate to my git tree and just git am /tmp/patch/to/patches.mbox.

Late to the party?

If you subscribed to a mailing list and you stumble upon some patches or messages that occurred prior to your subscription but you still want to participate in, not all is lost. Many mailing list archives let you download previous emails, usually bundled by the month they were sent.

I use the ImportExportTools NG Thunderbird addon to import emails from the archives into Thunderbird. Once they’ve been imported, you can reply or read them at your leisure. I’ve found this to be a good way to get caught up on mailing lists. For reading a short thread or two, the HTML archive view is fine; for anything more involved than that, it’s more comfortable to read inside of Thunderbird, in my opinion.

Composing Emails

For a while, I would use the regular editor that comes with Thunderbird. However, it can be hard to consistently indent things or keep the width of my paragraphs to a consistent level in the editor since it doesn’t include line or column information. I also prefer using Vim or Vim keybindings to edit text.

Since the exteditor addon is incompatible with newer versions of Thunderbird, I just open a terminal emulator and type my messages up in Vim. If I am replying to an email and I want to quote parts of it, I will just cut and paste the contents of the Thunderbird editor into Vim, then I put Vim into email mode:

:set filetype=mail colorcolumn=72

Or, to spend less time typing:

:set ft=mail cc=72

This way the syntax highlighting is much nicer with quoted snippets and I can keep the widths of my paragraphs consistent with the color column or column information that Vim shows me. Furthermore, with the filetype set to “mail”, Vim will automatically break to a new line when I threaten to exceed the conventional 72 character width of plaintext emails.

When I am ready to send my email, I just copy the contents of my Vim buffer and paste it into the Thunderbird editor and hit “Send”.

The xclip(1) package is very useful for this. To copy the entirety of my Vim buffer, all I have to do is type:

:w !xclip -sel clip

Then select the Thunderbird editor and hit ctrl+V!

Note: I don’t have a suggestion for a Windows or macOS equivalent to the xclip(1) tool. Sorry! If you know of one, let me know and I can update this post.

Conclusion

That just about sums up everything about my Thunderbird workflow that makes me feel productive.

There is no reward for reading a blog post as banal as this. 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *