1 Return-Path: <markwalters1009@gmail.com>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 2F1B3431FDB
\r
6 for <notmuch@notmuchmail.org>; Sun, 29 Apr 2012 15:48:18 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0.201 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,
\r
14 RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
15 Received: from olra.theworths.org ([127.0.0.1])
\r
16 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
17 with ESMTP id EiHIWtLHkJdM for <notmuch@notmuchmail.org>;
\r
18 Sun, 29 Apr 2012 15:48:15 -0700 (PDT)
\r
19 Received: from mail-wi0-f179.google.com (mail-wi0-f179.google.com
\r
20 [209.85.212.179]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
21 (No client certificate requested)
\r
22 by olra.theworths.org (Postfix) with ESMTPS id B8A2B429E30
\r
23 for <notmuch@notmuchmail.org>; Sun, 29 Apr 2012 15:48:09 -0700 (PDT)
\r
24 Received: by wibhn6 with SMTP id hn6so1883957wib.2
\r
25 for <notmuch@notmuchmail.org>; Sun, 29 Apr 2012 15:48:08 -0700 (PDT)
\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
\r
27 h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
\r
28 bh=bNNT/YJ/3A1Z5RpWKaHgWEe+CYQ62jltKpaiP4qm1wo=;
\r
29 b=POUUzcjaX4P0LNrlOArapvKkq6yq2Q7Gtj/uZXN0vYBwDYlLuMdAMHbBSnlEOnqpuz
\r
30 S8+LzhHdBqmbgspYILONV1CJMy9jNsSX+hTPBmgwjJB8macv0fGutQZBJ63shTauxxFA
\r
31 JP4qtu6IPaSEto/PjRdaNYfmMPOf+93zZkpBIZZlR+P6SdGSzDJZdm3VXBFlfHJlB1vH
\r
32 meP0JlHxopnMyEd0HaYNSoLOhGxtLZIzuoAgq/oaadsVn0gH5/lpifKjvU6XDyWcL+5H
\r
33 AURqO9sWpuitIcgnMOdG2hQbSx+YBjC8mVHYQZ3vZeUYJp3+FPzKfvphvzrdIaFOxOTO
\r
35 Received: by 10.180.78.105 with SMTP id a9mr23754226wix.20.1335739688473;
\r
36 Sun, 29 Apr 2012 15:48:08 -0700 (PDT)
\r
37 Received: from localhost (94-192-233-223.zone6.bethere.co.uk.
\r
38 [94.192.233.223]) by mx.google.com with ESMTPS id
\r
39 k6sm24217932wiy.7.2012.04.29.15.48.06 (version=TLSv1/SSLv3 cipher=OTHER);
\r
40 Sun, 29 Apr 2012 15:48:07 -0700 (PDT)
\r
41 From: Mark Walters <markwalters1009@gmail.com>
\r
42 To: notmuch@notmuchmail.org
\r
43 Subject: [Patch v2 2/3] emacs: Add `notmuch-show-line-faces' and apply it.
\r
44 Date: Sun, 29 Apr 2012 23:48:16 +0100
\r
45 Message-Id: <1335739697-8501-3-git-send-email-markwalters1009@gmail.com>
\r
46 X-Mailer: git-send-email 1.7.9.1
\r
47 In-Reply-To: <1335739697-8501-1-git-send-email-markwalters1009@gmail.com>
\r
48 References: <1335739697-8501-1-git-send-email-markwalters1009@gmail.com>
\r
49 X-BeenThere: notmuch@notmuchmail.org
\r
50 X-Mailman-Version: 2.1.13
\r
52 List-Id: "Use and development of the notmuch mail system."
\r
53 <notmuch.notmuchmail.org>
\r
54 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
55 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
56 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
57 List-Post: <mailto:notmuch@notmuchmail.org>
\r
58 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
59 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
60 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
61 X-List-Received-Date: Sun, 29 Apr 2012 22:48:18 -0000
\r
63 Similar to `notmuch-search-line-faces', `notmuch-show-line-faces'
\r
64 allows the header line in `notmuch-show-mode' buffers to be coloured
\r
65 according to the tags of the message. This is just a rebased version of
\r
66 the emacs/notmuch-show.el of David Edmondson's patch
\r
67 id:"1325006003-27152-1-git-send-email-dme@dme.org"
\r
69 emacs/notmuch-show.el | 33 +++++++++++++++++++++++++++++----
\r
70 1 files changed, 29 insertions(+), 4 deletions(-)
\r
72 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
73 index 37f0ebb..bb7db6e 100644
\r
74 --- a/emacs/notmuch-show.el
\r
75 +++ b/emacs/notmuch-show.el
\r
76 @@ -93,6 +93,24 @@ any given message."
\r
77 :group 'notmuch-show
\r
78 :group 'notmuch-hooks)
\r
80 +(defcustom notmuch-show-line-faces nil
\r
81 + "Tag to face mapping for header line highlighting in `notmuch-show-mode'.
\r
83 +Here is an example of how to color search results based on tags.
\r
84 + (the following text would be placed in your ~/.emacs file):
\r
86 + (setq notmuch-search-line-faces '((\"delete\" . (:foreground \"red\"
\r
87 + :background \"blue\"))
\r
88 + (\"unread\" . (:foreground \"green\"))))
\r
90 +The attributes defined for matching tags are merged, with later
\r
91 +attributes overriding earlier. A message having both \"delete\"
\r
92 +and \"unread\" tags with the above settings would have a green
\r
93 +foreground and blue background."
\r
94 + :type '(alist :key-type (string) :value-type (custom-face-edit))
\r
95 + :group 'notmuch-show
\r
96 + :group 'notmuch-faces)
\r
98 ;; Mostly useful for debugging.
\r
99 (defcustom notmuch-show-all-multipart/alternative-parts t
\r
100 "Should all parts of multipart/alternative parts be shown?"
\r
101 @@ -411,7 +429,8 @@ unchanged ADDRESS if parsing fails."
\r
102 (defun notmuch-show-insert-headerline (headers date tags depth)
\r
103 "Insert a notmuch style headerline based on HEADERS for a
\r
104 message at DEPTH in the current thread."
\r
105 - (let ((start (point)))
\r
106 + (let ((start (point))
\r
108 (insert (notmuch-show-spaces-n (* notmuch-show-indent-messages-width depth))
\r
109 (notmuch-show-clean-address (plist-get headers :From))
\r
111 @@ -420,7 +439,9 @@ message at DEPTH in the current thread."
\r
112 (propertize (mapconcat 'identity tags " ")
\r
113 'face 'notmuch-tag-face)
\r
115 - (overlay-put (make-overlay start (point)) 'face 'notmuch-message-summary-face)))
\r
116 + (setq overlay (make-overlay start (point)))
\r
117 + (overlay-put overlay 'face 'notmuch-message-summary-face)
\r
118 + (overlay-put overlay 'priority 2)))
\r
120 (defun notmuch-show-insert-header (header header-value)
\r
121 "Insert a single header."
\r
122 @@ -852,7 +873,8 @@ current buffer, if possible."
\r
123 body-start body-end
\r
124 (headers-invis-spec (notmuch-show-make-symbol "header"))
\r
125 (message-invis-spec (notmuch-show-make-symbol "message"))
\r
126 - (bare-subject (notmuch-show-strip-re (plist-get headers :Subject))))
\r
127 + (bare-subject (notmuch-show-strip-re (plist-get headers :Subject)))
\r
128 + (tags (plist-get msg :tags)))
\r
130 ;; Set `buffer-invisibility-spec' to `nil' (a list), otherwise
\r
131 ;; removing items from `buffer-invisibility-spec' (which is what
\r
132 @@ -877,10 +899,13 @@ current buffer, if possible."
\r
133 (plist-get msg :date_relative)
\r
135 (plist-get headers :Date))
\r
136 - (plist-get msg :tags) depth)
\r
139 (setq content-start (point-marker))
\r
141 + ;; Colour the header line according to the tags of the message.
\r
142 + (notmuch-color-line message-start content-start tags notmuch-show-line-faces)
\r
144 (plist-put msg :headers-invis-spec headers-invis-spec)
\r
145 (plist-put msg :message-invis-spec message-invis-spec)
\r