1 Return-Path: <pieter@praet.org>
\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 41DC9431FAF
\r
6 for <notmuch@notmuchmail.org>; Mon, 16 Jan 2012 08:59:28 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id 5EWhIKv30WKX for <notmuch@notmuchmail.org>;
\r
16 Mon, 16 Jan 2012 08:59:27 -0800 (PST)
\r
17 Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com
\r
18 [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id 8B04B431FAE
\r
21 for <notmuch@notmuchmail.org>; Mon, 16 Jan 2012 08:59:27 -0800 (PST)
\r
22 Received: by wibhr12 with SMTP id hr12so2632349wib.26
\r
23 for <notmuch@notmuchmail.org>; Mon, 16 Jan 2012 08:59:26 -0800 (PST)
\r
24 Received: by 10.180.88.229 with SMTP id bj5mr21773950wib.5.1326733166316;
\r
25 Mon, 16 Jan 2012 08:59:26 -0800 (PST)
\r
26 Received: from localhost ([109.131.75.86])
\r
27 by mx.google.com with ESMTPS id fi6sm35082784wib.2.2012.01.16.08.59.25
\r
28 (version=TLSv1/SSLv3 cipher=OTHER);
\r
29 Mon, 16 Jan 2012 08:59:25 -0800 (PST)
\r
30 From: Pieter Praet <pieter@praet.org>
\r
31 To: David Edmondson <dme@dme.org>,
\r
32 Jameson Graef Rollins <jrollins@finestructure.net>
\r
33 Subject: [PATCH] v2 emacs: colorize buttonized 'id:' links depending on the
\r
34 target message's state
\r
35 Date: Mon, 16 Jan 2012 17:57:33 +0100
\r
36 Message-Id: <1326733053-25185-1-git-send-email-pieter@praet.org>
\r
37 X-Mailer: git-send-email 1.7.8.1
\r
38 In-Reply-To: <87hazva8qe.fsf@praet.org>
\r
39 References: <87hazva8qe.fsf@praet.org>
\r
40 Cc: Notmuch Mail <notmuch@notmuchmail.org>
\r
41 X-BeenThere: notmuch@notmuchmail.org
\r
42 X-Mailman-Version: 2.1.13
\r
44 List-Id: "Use and development of the notmuch mail system."
\r
45 <notmuch.notmuchmail.org>
\r
46 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
47 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
48 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
49 List-Post: <mailto:notmuch@notmuchmail.org>
\r
50 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
51 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
52 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
53 X-List-Received-Date: Mon, 16 Jan 2012 16:59:28 -0000
\r
55 * emacs/notmuch-show.el (notmuch-show-buttonized-link-colors):
\r
56 new defcustom, allows toggling colorization of buttonized links.
\r
58 * emacs/notmuch-show.el (notmuch-show-buttonized-link-present),
\r
59 * emacs/notmuch-show.el (notmuch-show-buttonized-link-present-and-unread),
\r
60 * emacs/notmuch-show.el (notmuch-show-buttonized-link-missing):
\r
61 new faces for buttonized id: links.
\r
63 * emacs/notmuch-show.el (notmuch-show-found-target-p): add optional arg
\r
64 VERIFY-UNREAD which causes results to be filtered by "tag:unread".
\r
66 * emacs/notmuch-show.el (notmuch-show-buttonize-links): use different
\r
67 face property depending on the result of `notmuch-show-found-target-p',
\r
68 causing buttons to available, available-and-unread and missing messages
\r
69 to be displayed in a different color.
\r
75 - add `notmuch-show-buttonized-link-colors': new defcustom, allows
\r
76 toggling colorization of buttonized links, to address concerns re
\r
78 - ... and some minor refactoring
\r
81 emacs/notmuch-show.el | 45 ++++++++++++++++++++++++++++++++++++++++++---
\r
82 1 files changed, 42 insertions(+), 3 deletions(-)
\r
84 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
85 index 7a79d06..c6d7e29 100644
\r
86 --- a/emacs/notmuch-show.el
\r
87 +++ b/emacs/notmuch-show.el
\r
88 @@ -794,6 +794,38 @@ current buffer, if possible."
\r
89 (defvar notmuch-show-buffer-name nil)
\r
90 (make-variable-buffer-local 'notmuch-show-buffer-name)
\r
92 +(defcustom notmuch-show-buttonized-link-colors t
\r
93 + "Colorize buttonized links depending on their target's state.
\r
95 +Also see `notmuch-show-buttonized-link-available',
\r
96 + `notmuch-show-buttonized-link-available-and-unread',
\r
97 + `notmuch-show-buttonized-link-missing'.
\r
99 +Might impact performance."
\r
101 + :group 'notmuch-show)
\r
103 +(defface notmuch-show-buttonized-link-available
\r
104 + '((t (:inherit goto-address-mail-face :foreground "blue")))
\r
105 + "Face used for buttonized links to messages which are present
\r
106 +in the mail store."
\r
107 + :group 'notmuch-show
\r
108 + :group 'notmuch-faces)
\r
110 +(defface notmuch-show-buttonized-link-available-and-unread
\r
111 + '((t (:inherit goto-address-mail-face :foreground "green")))
\r
112 + "Face used for buttonized links to messages which are present
\r
113 +in the mail store, and are tagged `unread'."
\r
114 + :group 'notmuch-show
\r
115 + :group 'notmuch-faces)
\r
117 +(defface notmuch-show-buttonized-link-missing
\r
118 + '((t (:inherit goto-address-mail-face :foreground "red")))
\r
119 + "Face used for buttonized links to messages which are NOT
\r
120 +present in in the mail store."
\r
121 + :group 'notmuch-show
\r
122 + :group 'notmuch-faces)
\r
124 (defun notmuch-show-buttonize-links (start end)
\r
125 "Buttonize URLs and mail addresses between START and END.
\r
127 @@ -813,7 +845,14 @@ a corresponding notmuch search."
\r
128 (notmuch-show-if-found ,message-id))
\r
130 'help-echo "Mouse-1, RET: search for this message"
\r
131 - 'face goto-address-mail-face)))))
\r
132 + 'face (if notmuch-show-buttonized-link-colors
\r
134 + ((notmuch-show-found-target-p message-id "and tag:unread")
\r
135 + 'notmuch-show-buttonized-link-available-and-unread)
\r
136 + ((notmuch-show-found-target-p message-id nil)
\r
137 + 'notmuch-show-buttonized-link-available)
\r
138 + (t 'notmuch-show-buttonized-link-missing))
\r
139 + 'goto-address-mail-face))))))
\r
142 (defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name crypto-switch)
\r
143 @@ -906,8 +945,8 @@ thread id. If a prefix is given, crypto processing is toggled."
\r
144 (notmuch-kill-this-buffer)
\r
145 (notmuch-show-worker thread-id parent-buffer query-context buffer-name process-crypto)))
\r
147 -(defun notmuch-show-found-target-p (target)
\r
148 - (let ((args `("count" ,target)))
\r
149 +(defun notmuch-show-found-target-p (target &optional subquery)
\r
150 + (let ((args `("count" ,target ,(or subquery ""))))
\r
151 (> (string-to-number
\r
152 (with-output-to-string
\r
153 (apply 'call-process notmuch-command nil standard-output nil args)))
\r