--- /dev/null
+Return-Path: <jani@nikula.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 6818F431FD0\r
+ for <notmuch@notmuchmail.org>; Tue, 27 Dec 2011 11:57:42 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id EQXk+FQmZklk for <notmuch@notmuchmail.org>;\r
+ Tue, 27 Dec 2011 11:57:41 -0800 (PST)\r
+Received: from mail-ee0-f53.google.com (mail-ee0-f53.google.com\r
+ [74.125.83.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client\r
+ certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
+ 2E6C7431FB6 for <notmuch@notmuchmail.org>; Tue, 27 Dec 2011 11:57:40 -0800\r
+ (PST)\r
+Received: by eekd41 with SMTP id d41so14397251eek.26\r
+ for <notmuch@notmuchmail.org>; Tue, 27 Dec 2011 11:57:40 -0800 (PST)\r
+Received: by 10.213.14.131 with SMTP id g3mr5970331eba.63.1325015858370;\r
+ Tue, 27 Dec 2011 11:57:38 -0800 (PST)\r
+Received: from localhost (dsl-hkibrasgw4-fe5cdc00-23.dhcp.inet.fi.\r
+ [80.220.92.23])\r
+ by mx.google.com with ESMTPS id z43sm110750221eef.7.2011.12.27.11.57.35\r
+ (version=SSLv3 cipher=OTHER); Tue, 27 Dec 2011 11:57:37 -0800 (PST)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: David Edmondson <dme@dme.org>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH] emacs: Add `notmuch-show-line-faces' and apply it.\r
+In-Reply-To: <1325006003-27152-1-git-send-email-dme@dme.org>\r
+References: <1325006003-27152-1-git-send-email-dme@dme.org>\r
+User-Agent: Notmuch/0.10.2+133~gb08a3ab (http://notmuchmail.org) Emacs/23.3.1\r
+ (i686-pc-linux-gnu)\r
+Date: Tue, 27 Dec 2011 21:57:33 +0200\r
+Message-ID: <87d3b923f6.fsf@nikula.org>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 27 Dec 2011 19:57:42 -0000\r
+\r
+On Tue, 27 Dec 2011 17:13:23 +0000, David Edmondson <dme@dme.org> wrote:\r
+> Similar to `notmuch-search-line-faces', `notmuch-show-line-faces'\r
+> allows the header line in `notmuch-show-mode' buffers to be coloured\r
+> according to the tags of the message.\r
+\r
+Hi David, I've only given this a quick test drive, but so far it seems\r
+to work as expected. I think this would be a useful feature to have.\r
+\r
+The patch failed to apply cleanly without "emacs: Don't attempt to\r
+colour tags in `notmuch-show-mode'." Is there a dependency, or was this\r
+accidental?\r
+\r
+\r
+BR,\r
+Jani.\r
+\r
+\r
+> ---\r
+> emacs/notmuch-lib.el | 18 ++++++++++++++++++\r
+> emacs/notmuch-show.el | 32 ++++++++++++++++++++++++++++----\r
+> emacs/notmuch.el | 17 ++---------------\r
+> 3 files changed, 48 insertions(+), 19 deletions(-)\r
+> \r
+> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
+> index 0f856bf..1f00fe0 100644\r
+> --- a/emacs/notmuch-lib.el\r
+> +++ b/emacs/notmuch-lib.el\r
+> @@ -96,6 +96,24 @@ the user hasn't set this variable with the old or new value."\r
+> (interactive)\r
+> (kill-buffer (current-buffer)))\r
+> \r
+> +(defun notmuch-color-line (start end line-tag-list spec)\r
+> + "Colorize a line based on tags."\r
+> + ;; Create the overlay only if the message has tags which match one\r
+> + ;; of those specified in `spec'.\r
+> + (let (overlay)\r
+> + (mapc (lambda (elem)\r
+> + (let ((tag (car elem))\r
+> + (attributes (cdr elem)))\r
+> + (when (member tag line-tag-list)\r
+> + (when (not overlay)\r
+> + (setq overlay (make-overlay start end))\r
+> + (overlay-put overlay 'priority 5))\r
+> + ;; Merge the specified properties with any already\r
+> + ;; applied from an earlier match.\r
+> + (overlay-put overlay 'face\r
+> + (append (overlay-get overlay 'face) attributes)))))\r
+> + spec)))\r
+> +\r
+> ;;\r
+> \r
+> (defun notmuch-common-do-stash (text)\r
+> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+> index 24f0b40..0885bd5 100644\r
+> --- a/emacs/notmuch-show.el\r
+> +++ b/emacs/notmuch-show.el\r
+> @@ -88,6 +88,23 @@ any given message."\r
+> notmuch-wash-elide-blank-lines\r
+> notmuch-wash-excerpt-citations))\r
+> \r
+> +(defcustom notmuch-show-line-faces nil\r
+> + "Tag to face mapping for header line highlighting in `notmuch-show-mode'.\r
+> +\r
+> +Here is an example of how to color search results based on tags.\r
+> + (the following text would be placed in your ~/.emacs file):\r
+> +\r
+> + (setq notmuch-search-line-faces '((\"delete\" . (:foreground \"red\"\r
+> + :background \"blue\"))\r
+> + (\"unread\" . (:foreground \"green\"))))\r
+> +\r
+> +The attributes defined for matching tags are merged, with later\r
+> +attributes overriding earlier. A message having both \"delete\"\r
+> +and \"unread\" tags with the above settings would have a green\r
+> +foreground and blue background."\r
+> + :type '(alist :key-type (string) :value-type (custom-face-edit))\r
+> + :group 'notmuch)\r
+> +\r
+> ;; Mostly useful for debugging.\r
+> (defcustom notmuch-show-all-multipart/alternative-parts t\r
+> "Should all parts of multipart/alternative parts be shown?"\r
+> @@ -269,7 +286,8 @@ unchanged ADDRESS if parsing fails."\r
+> (defun notmuch-show-insert-headerline (headers date tags depth)\r
+> "Insert a notmuch style headerline based on HEADERS for a\r
+> message at DEPTH in the current thread."\r
+> - (let ((start (point)))\r
+> + (let ((start (point))\r
+> + overlay)\r
+> (insert (notmuch-show-spaces-n (* notmuch-indent-messages-width depth))\r
+> (notmuch-show-clean-address (plist-get headers :From))\r
+> " ("\r
+> @@ -277,7 +295,9 @@ message at DEPTH in the current thread."\r
+> ") ("\r
+> (mapconcat 'identity tags " ")\r
+> ")\n")\r
+> - (overlay-put (make-overlay start (point)) 'face 'notmuch-message-summary-face)))\r
+> + (setq overlay (make-overlay start (point)))\r
+> + (overlay-put overlay 'face 'notmuch-message-summary-face)\r
+> + (overlay-put overlay 'priority 2)))\r
+> \r
+> (defun notmuch-show-insert-header (header header-value)\r
+> "Insert a single header."\r
+> @@ -712,7 +732,8 @@ current buffer, if possible."\r
+> body-start body-end\r
+> (headers-invis-spec (notmuch-show-make-symbol "header"))\r
+> (message-invis-spec (notmuch-show-make-symbol "message"))\r
+> - (bare-subject (notmuch-show-strip-re (plist-get headers :Subject))))\r
+> + (bare-subject (notmuch-show-strip-re (plist-get headers :Subject)))\r
+> + (tags (plist-get msg :tags)))\r
+> \r
+> ;; Set `buffer-invisibility-spec' to `nil' (a list), otherwise\r
+> ;; removing items from `buffer-invisibility-spec' (which is what\r
+> @@ -737,10 +758,13 @@ current buffer, if possible."\r
+> (plist-get msg :date_relative)\r
+> nil)\r
+> (plist-get headers :Date))\r
+> - (plist-get msg :tags) depth)\r
+> + tags depth)\r
+> \r
+> (setq content-start (point-marker))\r
+> \r
+> + ;; Colour the header line according to the tags of the message.\r
+> + (notmuch-color-line message-start content-start tags notmuch-show-line-faces)\r
+> +\r
+> (plist-put msg :headers-invis-spec headers-invis-spec)\r
+> (plist-put msg :message-invis-spec message-invis-spec)\r
+> \r
+> diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+> index 4844385..56d35d0 100644\r
+> --- a/emacs/notmuch.el\r
+> +++ b/emacs/notmuch.el\r
+> @@ -641,7 +641,7 @@ This function advances the next thread when finished."\r
+> (forward-line (1- notmuch-search-target-line))))))))\r
+> \r
+> (defcustom notmuch-search-line-faces nil\r
+> - "Tag/face mapping for line highlighting in notmuch-search.\r
+> + "Tag to face mapping for line highlighting in `notmuch-search-mode'.\r
+> \r
+> Here is an example of how to color search results based on tags.\r
+> (the following text would be placed in your ~/.emacs file):\r
+> @@ -659,20 +659,7 @@ foreground and blue background."\r
+> \r
+> (defun notmuch-search-color-line (start end line-tag-list)\r
+> "Colorize lines in `notmuch-show' based on tags."\r
+> - ;; Create the overlay only if the message has tags which match one\r
+> - ;; of those specified in `notmuch-search-line-faces'.\r
+> - (let (overlay)\r
+> - (mapc (lambda (elem)\r
+> - (let ((tag (car elem))\r
+> - (attributes (cdr elem)))\r
+> - (when (member tag line-tag-list)\r
+> - (when (not overlay)\r
+> - (setq overlay (make-overlay start end)))\r
+> - ;; Merge the specified properties with any already\r
+> - ;; applied from an earlier match.\r
+> - (overlay-put overlay 'face\r
+> - (append (overlay-get overlay 'face) attributes)))))\r
+> - notmuch-search-line-faces)))\r
+> + (notmuch-color-line start end line-tag-list notmuch-search-line-faces))\r
+> \r
+> (defun notmuch-search-author-propertize (authors)\r
+> "Split `authors' into matching and non-matching authors and\r
+> -- \r
+> 1.7.7.3\r
+> \r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r