message-view-patch icon indicating copy to clipboard operation
message-view-patch copied to clipboard

Colorize patch emails in mu4e and gnus

#+TITLE: README

[[https://melpa.org/#/message-view-patch][file:https://melpa.org/packages/message-view-patch-badge.svg]]

  • message-view-patch

=mu4e= and =gnus= extension to colorize patch-like emails. Based on [[https://github.com/orgcandman/emacs-plugins/blob/master/gnus-article-treat-patch.el][gnus-article-treat-patch.el]] and adapted to work with =mu4e=. It also continues to work with =gnus=.

This package was renamed from =mu4e-patch= to =message-view-patch= to reflect that it works with both =mu4e= and =gnus= (and maybe others?).

  • Installation

The package =message-view-patch= may be installed directly from [[https://melpa.org/#/org-ql][MELPA]] or with other tools like [[https://github.com/raxod502/straight.el][straight.el]].

After installation, add the hook,

#+BEGIN_SRC emacs-lisp ;; colorize patch-based emails (add-hook 'gnus-part-display-hook 'message-view-patch-highlight) #+END_SRC

  • Using the old mu4e-view

For users that set =mu4e-view-use-old= to non-nil, they might also want to get the =mu4e= faces, too. For that, the following code might be helpful,

#+begin_src emacs-lisp (require 'mu4e) (require 'message-view-patch)

(add-hook 'mu4e-view-mode-hook #'message-view-patch-highlight)

(setq mu4e-view-use-old t message-view-patch-pseudo-headers '(("^Acked-by: " 'mu4e-header-key-face 'mu4e-header-value-face) ("^C\(c\|C\): " 'mu4e-header-key-face 'mu4e-header-value-face) ("^From: " 'mu4e-header-key-face 'mu4e-header-value-face) ("^Link: " 'mu4e-header-key-face 'mu4e-header-value-face) ("^Reported-by: " 'mu4e-header-key-face 'mu4e-header-value-face) ("^Reviewed-by: " 'mu4e-header-key-face 'mu4e-header-value-face) ("^Signed-off-by: " 'mu4e-header-key-face 'mu4e-header-value-face) ("^Subject: " 'mu4e-header-key-face 'mu4e-header-value-face) ("^Tested-by: " 'mu4e-header-key-face 'mu4e-header-value-face)))

(set-face-attribute 'message-view-patch-cite-1 nil :inherit 'mu4e-cited-1-face) (set-face-attribute 'message-view-patch-cite-2 nil :inherit 'mu4e-cited-2-face) (set-face-attribute 'message-view-patch-cite-3 nil :inherit 'mu4e-cited-3-face) (set-face-attribute 'message-view-patch-cite-4 nil :inherit 'mu4e-cited-4-face) (set-face-attribute 'message-view-patch-cite-5 nil :inherit 'mu4e-cited-5-face) (set-face-attribute 'message-view-patch-cite-6 nil :inherit 'mu4e-cited-6-face) (set-face-attribute 'message-view-patch-cite-7 nil :inherit 'mu4e-cited-7-face) #+end_src