Skip to contentSkip to conversation

Some mutt(1) patches and scripts

DISCUSSION Taylor Blau 1 participant 1 message Apr 22, 2018

lore
Share & tools
lore
#0 lore raw

Hi,

I have spent more time contributing to the Git list lately, and as such have grown a number of patches and scripts that have been useful for my workflow. I am interested in sharing them here in the hopes that they will be useful for others as well :-).

My workflow is as follows:

1. Write some commits.

2. Prepare them with 'git mail' (a wrapper over 'git-format-patch(1)').

3. Edit the cover letter template, and look them over in Mutt before sending them to the list.

I suspect that (2) and (3) are somewhat unconventional. My 'git mail' script, in particular, has been useful to me. The contents looks (basically) as follows [1]:

  mbox=$(mktemp)
  git format-patch --stdout $@ >"$mbox" && mutt -f "$mbox"

This has been useful in not having to move around many *.patch files in an out of a directory. I enjoy looking at a series as a thread in mutt(1) rather than as individual files in $EDITOR.

Mutt is not particularly keen to resend email so I have had to teach it a few tricks:

1. Macros "b" and "B" to resend and force-resend the highlighted message. [2]

macro index,pager b ":set edit_headers=yes<enter><resend-message>:set edit_headers=no<enter>" macro index,pager B ":set editor=true<enter><resend-message><send-message>:set editor=$EDITOR<enter>"

2. A patch to not destroy the original Message-ID header when resending email. Mutt (sensibly) does this by default, but it is not suitable for my workflow, as when I edit the cover letter template the Message-ID changes and subsequent patches are sent in response to a non-existent message.

I have patched Mutt to remove this behavior, and (since I work on macOS) set up a Homebrew tap to install mutt with `--with-retain-messageid'. [3]

Thanks,
Taylor

[1]: https://github.com/ttaylorr/dotfiles/blob/work-gh/bin/git-mail
[2]: https://github.com/ttaylorr/dotfiles/blob/work-gh/mutt/.muttrc#L43-L44
[3]: https://github.com/ttaylorr/homebrew-mutt