fontify-patch is an Emacs package for fontifying buffers (or strings) that contain patch diffs. For example, mail buffers containing patches:
fontify-patch can be used for any suitable mode. To fontify a buffer, just call
fontify-patch-buffer
(to fontify just a string, use fontify-patch-text
).
For example, to fontify mail containing patches with the email client mu4e
(which uses gnus
to display messages), call fontify-patch-buffer
in the
display hook:
(add-hook 'gnus-part-display-hook 'fontify-patch-buffer)
A complete example configuration could look like this:
(use-package fontify-patch
:after mu4e
:load-path "/path/to/fontify-patch" ;; Until availabe in MELPA.
:config
(add-hook 'gnus-part-display-hook 'fontify-patch-buffer))