When you are subscribed to development mailinglists, then you'll be seeing quite a number of mails containg patch information inlined into the mail. With systems like git's send-email/am such mails can contain all the information for creating entire commits from the email. Git's own development list uses that approach for example. Other projects use it for external contributors to submit patches.

Now when I look at such a mail in gnus, it looks like this:

old style patch mail

Now to hightlight the patch content better, I could run diff-mode on the part of the mail. But diff-mode doesn't understand things like pseudo headers, scissor lines and diff-stats.

So I did a little lisp exercise and came up with gnus-article-treat-patch.el. Using that, a patch mail suddenly looks like this:

new style patch mail

Much nicer. The highlighting is fairly configurable, too.

The system is not perfect, but it's good enough for me. I thought about submitting it to the gnus developers, but I guess it's not polished enough for inclusion. And I don't think I really want to spent too much additional time on it.

The add-on is disabled by default. Something like the following will activate it:

(require 'gnus-article-treat-patch)
(setq ft/gnus-article-patch-conditions
      '( "^@@ -[0-9]+,[0-9]+ \\+[0-9]+,[0-9]+ @@" ))
Posted Sun 05 Jun 2011 13:40:43 CEST Tags: