--- /dev/null
+Return-Path: <markwalters1009@gmail.com>\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 892E7431FC9\r
+ for <notmuch@notmuchmail.org>; Sat, 5 May 2012 06:39:50 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.201\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
+ 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 YW5hurwn-XSp for <notmuch@notmuchmail.org>;\r
+ Sat, 5 May 2012 06:39:49 -0700 (PDT)\r
+Received: from mail-we0-f181.google.com (mail-we0-f181.google.com\r
+ [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 76DF5431FC7\r
+ for <notmuch@notmuchmail.org>; Sat, 5 May 2012 06:39:48 -0700 (PDT)\r
+Received: by werm13 with SMTP id m13so2702719wer.26\r
+ for <notmuch@notmuchmail.org>; Sat, 05 May 2012 06:39:47 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+ h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
+ bh=DPGmWp7F6nMRKhFdG4KmKYpQLCAlbv/iqYHlsehlwWU=;\r
+ b=YV3wv+nkeAoKBmO+vyE5SRx/LpbuLLvPf0sinqmc/g9jWMXe7MKOS4UhquonZCWmqq\r
+ ZYaUbxbm/DYzMHVns/d0tgSYFffCy/eJPR4O9SxadVhj2/iwVrzqyX7EiLj+o9t4sG7z\r
+ 5/+xU0elVAc+upJykUilsVPzXGxsj0nJfd8+G7EYozxl8PEU/tJx+53DVd9Pc8t6yN63\r
+ 1w6r+CMOHwYw9Hkhqx0HH89fqy4PhAmffA889KPvpAJo00U6oVc4JZsvTU8mqO091T9i\r
+ KnFk+Td19Zm5UgU1g78495/squDNm56FBwH9ZPuDrqQCUXJuO8TWJVhg2UBaiHY+vxjK\r
+ HiMA==\r
+Received: by 10.180.90.233 with SMTP id bz9mr20566468wib.21.1336225187128;\r
+ Sat, 05 May 2012 06:39:47 -0700 (PDT)\r
+Received: from localhost (94-192-233-223.zone6.bethere.co.uk.\r
+ [94.192.233.223]) by mx.google.com with ESMTPS id\r
+ e6sm5781484wix.8.2012.05.05.06.39.45 (version=TLSv1/SSLv3 cipher=OTHER); Sat,\r
+ 05 May 2012 06:39:46 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [Patch v3 4/4] emacs: allow notmuch-show-line-faces to use flags for\r
+ colouring\r
+Date: Sat, 5 May 2012 14:39:47 +0100\r
+Message-Id: <1336225187-8772-5-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\r
+In-Reply-To: <1336225187-8772-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1336225187-8772-1-git-send-email-markwalters1009@gmail.com>\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: Sat, 05 May 2012 13:39:50 -0000\r
+\r
+This allows header-lines `notmuch-show-mode' buffers to be coloured\r
+based on the flags (match/excluded) of the message. It supplies the\r
+line colouring function with a list of tags each prefixed with "tag:"\r
+and a list of flags ("match" or "excluded") each prefixed with\r
+"flag:".\r
+\r
+The match flag is obviously not equivalent to a tag; the excluded flag\r
+looks equivalent but is subtly different: a message is not marked\r
+excluded if that tag appeared in the query.\r
+---\r
+ emacs/notmuch-show.el | 28 ++++++++++++++++++++++------\r
+ 1 files changed, 22 insertions(+), 6 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index e62f0a0..94399c5 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -96,17 +96,24 @@ any given message."\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
++Here is an example of how to color search results based on tags\r
++and flags (match and excluded).\r
+ (the following text would be placed in your ~/.emacs file):\r
+ \r
+- (setq notmuch-show-line-faces '((\"deleted\" . (:foreground \"red\"\r
++ (setq notmuch-show-line-faces '((\"tag:deleted\" . (:foreground \"red\"\r
+ :background \"blue\"))\r
+- (\"unread\" . (:foreground \"green\"))))\r
++ (\"tag:unread\" . (:foreground \"green\"))\r
++ (\"flag:excluded\" . (:background \"grey\"))))\r
+ \r
+-The attributes defined for matching tags are merged, with later\r
++The attributes defined for matching tags/flags 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
++foreground and blue background.\r
++\r
++Alternatively, here is an example of colouring using the same\r
++criteria as for search results:\r
++ (setq notmuch-show-line-faces notmuch-search-line-faces)"\r
++\r
+ :type '(alist :key-type (string) :value-type (custom-face-edit))\r
+ :group 'notmuch-show\r
+ :group 'notmuch-faces)\r
+@@ -871,11 +878,20 @@ current buffer, if possible."\r
+ content-start content-end\r
+ headers-start headers-end\r
+ body-start body-end\r
++ tags-and-flags\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
+ (tags (plist-get msg :tags)))\r
+ \r
++ (mapc (lambda (tag)\r
++ (setq tags-and-flags (cons (concat "tag:" tag) tags-and-flags)))\r
++ tags)\r
++ (if (plist-get msg :match)\r
++ (setq tags-and-flags (cons "flag:match" tags-and-flags)))\r
++ (if (plist-get msg :excluded)\r
++ (setq tags-and-flags (cons "flag:excluded" tags-and-flags)))\r
++\r
+ ;; Set `buffer-invisibility-spec' to `nil' (a list), otherwise\r
+ ;; removing items from `buffer-invisibility-spec' (which is what\r
+ ;; `notmuch-show-headers-visible' and\r
+@@ -904,8 +920,7 @@ current buffer, if possible."\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
++ (notmuch-color-line message-start content-start tags-and-flags 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
+1.7.9.1\r
+\r