+(defcustom notmuch-search-line-faces nil
+ "Tag/face mapping for line highlighting in notmuch-search.
+
+Here is an example of how to color search results based on tags.
+(the following text would be placed in your ~/.emacs file):
+
+(setq notmuch-search-line-faces '((\"delete\" . '(:foreground \"red\"))
+ (\"unread\" . '(:foreground \"green\"))))
+
+Order matters: for lines with multiple tags, the the first
+matching will be applied."
+ :type '(alist :key-type (string) :value-type (list))
+ :group 'notmuch)
+
+(defun notmuch-search-color-line (start end line-tag-list)
+ "Colorize lines in notmuch-show based on tags"
+ (if notmuch-search-line-faces
+ (let ((overlay (make-overlay start end))
+ (tags-faces (copy-alist notmuch-search-line-faces)))
+ (while tags-faces
+ (let* ((tag-face (car tags-faces))
+ (tag (car tag-face))
+ (face (cdr tag-face)))
+ (cond ((member tag line-tag-list)
+ (overlay-put overlay 'face face)
+ (setq tags-faces nil))
+ (t
+ (setq tags-faces (cdr tags-faces)))))))))
+