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 7534D429E36
\r
6 for <notmuch@notmuchmail.org>; Sun, 29 Apr 2012 15:48:23 -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 8kHd+++RHBd9 for <notmuch@notmuchmail.org>;
\r
18 Sun, 29 Apr 2012 15:48:21 -0700 (PDT)
\r
19 Received: from mail-wg0-f45.google.com (mail-wg0-f45.google.com
\r
20 [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client
\r
21 certificate requested) by olra.theworths.org (Postfix) with ESMTPS id
\r
22 3F268431FDA for <notmuch@notmuchmail.org>; Sun, 29 Apr 2012 15:48:13 -0700
\r
24 Received: by wgbdt14 with SMTP id dt14so1973630wgb.2
\r
25 for <notmuch@notmuchmail.org>; Sun, 29 Apr 2012 15:48:10 -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=gAsLlCwH02M8uthqw3CVudh6WzBKVA+69J8gGwpsjew=;
\r
29 b=i8q+aAHnJ2SlLaTAM5maCD49wcBtJ2K6LMgLg93oejzrr2dZeVNBFFk7wWMQRyYRzW
\r
30 GWrCCLKiuHC02VUjIOJO0yUwaxDIF5unLRvdATtToUZaAHqiRwB6VrgupAsC5ZQ5jqVb
\r
31 K8mVFCq+R3Blx40mEjdD76X3T4XwhqO6LeKWf+tmKWoZkLyrrMOcwjtYLqyPNDmto270
\r
32 yuYqoj4rzFOx7NJT7xm1q9kVaNHKJdnVAMtQwiS44YFFCrrS5d1Fb8SIRfBs+rd2LJB8
\r
33 oSJDbLBZvXnmkhh75V+nhMckcrOJ/sMH2ZMIE18cHqITjeUFpSe3JUmreEexpJ+w6c3F
\r
35 Received: by 10.180.101.136 with SMTP id fg8mr24031124wib.4.1335739690631;
\r
36 Sun, 29 Apr 2012 15:48:10 -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 fz9sm24224283wib.3.2012.04.29.15.48.09 (version=TLSv1/SSLv3 cipher=OTHER);
\r
40 Sun, 29 Apr 2012 15:48:10 -0700 (PDT)
\r
41 From: Mark Walters <markwalters1009@gmail.com>
\r
42 To: notmuch@notmuchmail.org
\r
43 Subject: [Patch v2 3/3] emacs: allow notmuch-show-line-faces to use flags for
\r
45 Date: Sun, 29 Apr 2012 23:48:17 +0100
\r
46 Message-Id: <1335739697-8501-4-git-send-email-markwalters1009@gmail.com>
\r
47 X-Mailer: git-send-email 1.7.9.1
\r
48 In-Reply-To: <1335739697-8501-1-git-send-email-markwalters1009@gmail.com>
\r
49 References: <1335739697-8501-1-git-send-email-markwalters1009@gmail.com>
\r
50 X-BeenThere: notmuch@notmuchmail.org
\r
51 X-Mailman-Version: 2.1.13
\r
53 List-Id: "Use and development of the notmuch mail system."
\r
54 <notmuch.notmuchmail.org>
\r
55 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
56 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
57 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
58 List-Post: <mailto:notmuch@notmuchmail.org>
\r
59 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
60 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
61 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
62 X-List-Received-Date: Sun, 29 Apr 2012 22:48:23 -0000
\r
64 This allows header-lines `notmuch-show-mode' buffers to be coloured
\r
65 based on the flags (match/excluded) of the message. It supplies the
\r
66 line colouring function with a list of tags each prefixed with "tag:"
\r
67 and a list of flags ("match" or "excluded") each prefixed with
\r
70 The match flag is obviously not equivalent to a tag; the excluded flag
\r
71 looks equivalent but is subtly different: a message is not marked
\r
72 excluded if that tag appeared in the query.
\r
74 emacs/notmuch-show.el | 21 ++++++++++++++++-----
\r
75 1 files changed, 16 insertions(+), 5 deletions(-)
\r
77 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
78 index bb7db6e..f09de26 100644
\r
79 --- a/emacs/notmuch-show.el
\r
80 +++ b/emacs/notmuch-show.el
\r
81 @@ -96,14 +96,16 @@ any given message."
\r
82 (defcustom notmuch-show-line-faces nil
\r
83 "Tag to face mapping for header line highlighting in `notmuch-show-mode'.
\r
85 -Here is an example of how to color search results based on tags.
\r
86 +Here is an example of how to color search results based on tags
\r
87 +and flags (match and excluded).
\r
88 (the following text would be placed in your ~/.emacs file):
\r
90 - (setq notmuch-search-line-faces '((\"delete\" . (:foreground \"red\"
\r
91 + (setq notmuch-search-line-faces '((\"tag:delete\" . (:foreground \"red\"
\r
92 :background \"blue\"))
\r
93 - (\"unread\" . (:foreground \"green\"))))
\r
94 + (\"tag:unread\" . (:foreground \"green\"))
\r
95 + (\"flag:excluded\" . (:background \"grey\"))))
\r
97 -The attributes defined for matching tags are merged, with later
\r
98 +The attributes defined for matching tags/flags are merged, with later
\r
99 attributes overriding earlier. A message having both \"delete\"
\r
100 and \"unread\" tags with the above settings would have a green
\r
101 foreground and blue background."
\r
102 @@ -871,11 +873,20 @@ current buffer, if possible."
\r
103 content-start content-end
\r
104 headers-start headers-end
\r
105 body-start body-end
\r
107 (headers-invis-spec (notmuch-show-make-symbol "header"))
\r
108 (message-invis-spec (notmuch-show-make-symbol "message"))
\r
109 (bare-subject (notmuch-show-strip-re (plist-get headers :Subject)))
\r
110 (tags (plist-get msg :tags)))
\r
112 + (mapc (lambda (tag)
\r
113 + (setq tags-and-flags (cons (concat "tag:" tag) tags-and-flags)))
\r
115 + (if (plist-get msg :match)
\r
116 + (setq tags-and-flags (cons "flag:match" tags-and-flags)))
\r
117 + (if (plist-get msg :excluded)
\r
118 + (setq tags-and-flags (cons "flag:excluded" tags-and-flags)))
\r
120 ;; Set `buffer-invisibility-spec' to `nil' (a list), otherwise
\r
121 ;; removing items from `buffer-invisibility-spec' (which is what
\r
122 ;; `notmuch-show-headers-visible' and
\r
123 @@ -904,7 +915,7 @@ current buffer, if possible."
\r
124 (setq content-start (point-marker))
\r
126 ;; Colour the header line according to the tags of the message.
\r
127 - (notmuch-color-line message-start content-start tags notmuch-show-line-faces)
\r
128 + (notmuch-color-line message-start content-start tags-and-flags notmuch-show-line-faces)
\r
130 (plist-put msg :headers-invis-spec headers-invis-spec)
\r
131 (plist-put msg :message-invis-spec message-invis-spec)
\r