1 Return-Path: <aaronecay@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 852FA4196F2
\r
6 for <notmuch@notmuchmail.org>; Sun, 11 Apr 2010 16:27:41 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.599 tagged_above=-999 required=5
\r
12 tests=[BAYES_05=-0.5, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
\r
13 DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001]
\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 Iwi14GPEoGIE for <notmuch@notmuchmail.org>;
\r
18 Sun, 11 Apr 2010 16:27:40 -0700 (PDT)
\r
19 Received: from qw-out-1920.google.com (qw-out-1920.google.com [74.125.92.147])
\r
20 by olra.theworths.org (Postfix) with ESMTP id BFE0C431FC1
\r
21 for <notmuch@notmuchmail.org>; Sun, 11 Apr 2010 16:27:40 -0700 (PDT)
\r
22 Received: by qw-out-1920.google.com with SMTP id 5so1632319qwc.32
\r
23 for <notmuch@notmuchmail.org>; Sun, 11 Apr 2010 16:27:40 -0700 (PDT)
\r
24 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
\r
25 h=domainkey-signature:received:received:from:to:subject:date
\r
26 :message-id:x-mailer:in-reply-to:references;
\r
27 bh=gaE8zzJO5VJZNKXAb9gebzIcGpwbOzxrUbr2wlbrGT4=;
\r
28 b=K0fWwIB9jevGvQb14oTdDpORUdx0/vQOAbj2rilTBwiJVbNvTOUVHTL5TjzE3UB3RG
\r
29 kAFb6fIj5LOCtHM1QwUrma9j749n5N4pibXyoUXjtLWMYpefiG0z/uEPRKsNHat7QJox
\r
30 kdwXk/SLpgRZb/Xc5AMjwhSViI2bkT2+GUUaI=
\r
31 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
\r
32 h=from:to:subject:date:message-id:x-mailer:in-reply-to:references;
\r
33 b=aacYVHc35OCXre9qFrY6mB9gdMXDn4Q3khrjAZKWfquTHJEuTnhJ/GVd5jd2x/d5jS
\r
34 ZMwb8ZFRgajGiO0DJRdVpRpW0j1Bh3YEA6SjACkQpDHp4moAeanXvZuGEVBsQCsMOglJ
\r
35 g+mHRNgLtlv//Db/W1bz7IB9Pwt555LLTIpXg=
\r
36 Received: by 10.224.53.148 with SMTP id m20mr1144532qag.278.1271028460108;
\r
37 Sun, 11 Apr 2010 16:27:40 -0700 (PDT)
\r
38 Received: from localhost.localdomain (vpm120.wireless-resnet.upenn.edu
\r
40 by mx.google.com with ESMTPS id 6sm7336237qwk.21.2010.04.11.16.27.38
\r
41 (version=TLSv1/SSLv3 cipher=RC4-MD5);
\r
42 Sun, 11 Apr 2010 16:27:38 -0700 (PDT)
\r
43 From: Aaron Ecay <aaronecay@gmail.com>
\r
44 To: notmuch@notmuchmail.org
\r
45 Subject: [PATCH] Further improvements to tag-based coloring in search.
\r
46 Date: Sun, 11 Apr 2010 19:27:30 -0400
\r
48 <8491e4717d8c63b3dd046809458d3609ffd588b0.1271028205.git.aaronecay@gmail.com>
\r
49 X-Mailer: git-send-email 1.7.0.4
\r
50 In-Reply-To: <8739z7gm4d.fsf@yoom.home.cworth.org>
\r
51 References: <8739z7gm4d.fsf@yoom.home.cworth.org>
\r
52 X-BeenThere: notmuch@notmuchmail.org
\r
53 X-Mailman-Version: 2.1.13
\r
55 List-Id: "Use and development of the notmuch mail system."
\r
56 <notmuch.notmuchmail.org>
\r
57 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
58 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
59 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
60 List-Post: <mailto:notmuch@notmuchmail.org>
\r
61 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
62 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
63 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
64 X-List-Received-Date: Sun, 11 Apr 2010 23:27:41 -0000
\r
66 Makes the following improvements:
\r
67 - fix up doc strings
\r
68 - suppress the creation of unnecessary let-bindings
\r
69 - create overlays lazily (to avoid creating many overlays for threads
\r
70 that do not get colored)
\r
72 Signed-off-by: Aaron Ecay <aaronecay@gmail.com>
\r
74 emacs/notmuch.el | 21 ++++++++++-----------
\r
75 1 files changed, 10 insertions(+), 11 deletions(-)
\r
77 diff --git a/emacs/notmuch.el b/emacs/notmuch.el
\r
78 index 517c53a..03d89c1 100644
\r
79 --- a/emacs/notmuch.el
\r
80 +++ b/emacs/notmuch.el
\r
81 @@ -605,8 +605,7 @@ This function advances the next thread when finished."
\r
82 (defcustom notmuch-search-line-faces nil
\r
83 "Tag/face mapping for line highlighting in notmuch-search.
\r
85 -Here is an example of how to color search results based on tags.
\r
86 -(the following text would be placed in your ~/.emacs file):
\r
87 +Here is an example of how to color search results based on tags:
\r
89 (setq notmuch-search-line-faces '((\"delete\" . '(:foreground \"red\"))
\r
90 (\"unread\" . '(:foreground \"green\"))))
\r
91 @@ -617,16 +616,16 @@ matching will be applied."
\r
94 (defun notmuch-search-color-line (start end line-tag-list)
\r
95 - "Colorize lines in notmuch-show based on tags"
\r
96 - (if notmuch-search-line-faces
\r
97 - (let ((overlay (make-overlay start end))
\r
98 - (tags-faces (copy-alist notmuch-search-line-faces)))
\r
100 - (let* ((tag-face (car tags-faces))
\r
101 - (tag (car tag-face))
\r
102 - (face (cdr tag-face)))
\r
103 + "Colorize lines in notmuch-show based on tags.
\r
105 +Uses the tag/face mappings found in `notmuch-search-line-faces'."
\r
106 + (when notmuch-search-line-faces
\r
107 + (let ((tags-faces notmuch-search-line-faces))
\r
108 + (while tags-faces
\r
109 + (let ((tag (caar tags-faces))
\r
110 + (face (cdar tags-faces)))
\r
111 (cond ((member tag line-tag-list)
\r
112 - (overlay-put overlay 'face face)
\r
113 + (overlay-put (make-overlay start end) 'face face)
\r
114 (setq tags-faces nil))
\r
116 (setq tags-faces (cdr tags-faces)))))))))
\r