1 Return-Path: <dme@dme.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 CCA834196F2
\r
6 for <notmuch@notmuchmail.org>; Wed, 28 Apr 2010 23:52:08 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5
\r
12 tests=[BAYES_00=-1.9] autolearn=ham
\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 l3vrAqomkSqW for <notmuch@notmuchmail.org>;
\r
16 Wed, 28 Apr 2010 23:52:07 -0700 (PDT)
\r
17 Received: from mail-wy0-f181.google.com (mail-wy0-f181.google.com
\r
19 by olra.theworths.org (Postfix) with ESMTP id 41E7A431FC1
\r
20 for <notmuch@notmuchmail.org>; Wed, 28 Apr 2010 23:52:07 -0700 (PDT)
\r
21 Received: by wyj26 with SMTP id 26so2828306wyj.26
\r
22 for <notmuch@notmuchmail.org>; Wed, 28 Apr 2010 23:52:06 -0700 (PDT)
\r
23 Received: by 10.216.161.68 with SMTP id v46mr3733816wek.107.1272523926336;
\r
24 Wed, 28 Apr 2010 23:52:06 -0700 (PDT)
\r
25 Received: from ut.hh.sledj.net (gmp-ea-fw-1b.sun.com [192.18.8.1])
\r
26 by mx.google.com with ESMTPS id x1sm4781291wbx.19.2010.04.28.23.52.04
\r
27 (version=TLSv1/SSLv3 cipher=RC4-MD5);
\r
28 Wed, 28 Apr 2010 23:52:05 -0700 (PDT)
\r
29 Received: by ut.hh.sledj.net (Postfix, from userid 1000)
\r
30 id 1D64959411F; Thu, 29 Apr 2010 07:52:25 +0100 (BST)
\r
31 From: David Edmondson <dme@dme.org>
\r
32 To: notmuch@notmuchmail.org
\r
33 Subject: [PATCH 1/2] emacs: Display non-matching authors with a different
\r
35 Date: Thu, 29 Apr 2010 07:52:22 +0100
\r
36 Message-Id: <1272523943-25588-1-git-send-email-dme@dme.org>
\r
37 X-Mailer: git-send-email 1.7.0
\r
38 In-Reply-To: <1272477627-10562-1-git-send-email-dme@dme.org>
\r
39 References: <1272477627-10562-1-git-send-email-dme@dme.org>
\r
40 X-BeenThere: notmuch@notmuchmail.org
\r
41 X-Mailman-Version: 2.1.13
\r
43 List-Id: "Use and development of the notmuch mail system."
\r
44 <notmuch.notmuchmail.org>
\r
45 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
46 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
47 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
48 List-Post: <mailto:notmuch@notmuchmail.org>
\r
49 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
50 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
51 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
52 X-List-Received-Date: Thu, 29 Apr 2010 06:52:09 -0000
\r
54 In search mode some messages don't match the search criteria. Show
\r
55 their authors names with a different face - generally darker than
\r
56 those that do match.
\r
59 At Sebastian's request, allow the face to be customised.
\r
61 emacs/notmuch.el | 36 +++++++++++++++++++++++++++++-------
\r
62 1 files changed, 29 insertions(+), 7 deletions(-)
\r
64 diff --git a/emacs/notmuch.el b/emacs/notmuch.el
\r
65 index 7457da9..60c0ee5 100644
\r
66 --- a/emacs/notmuch.el
\r
67 +++ b/emacs/notmuch.el
\r
68 @@ -297,6 +297,17 @@ For a mouse binding, return nil."
\r
69 "Notmuch search mode face used to highligh tags."
\r
72 +(defface notmuch-search-non-matching-authors
\r
74 + (background dark))
\r
75 + (:foreground "grey30"))
\r
77 + (background light))
\r
78 + (:foreground "grey60"))
\r
80 + "Face used in search mode for authors not matching the query."
\r
84 (defun notmuch-search-mode ()
\r
85 "Major mode displaying results of a notmuch search.
\r
86 @@ -576,6 +587,23 @@ matching will be applied."
\r
88 (setq tags-faces (cdr tags-faces)))))))))
\r
90 +(defun notmuch-search-insert-authors (format-string authors)
\r
91 + (insert (let* ((formatted-sample (format format-string ""))
\r
92 + (formatted-authors (format format-string authors))
\r
94 + (if (> (length formatted-authors)
\r
95 + (length formatted-sample))
\r
96 + (concat (substring authors 0 (- (length formatted-sample) 4)) "... ")
\r
97 + formatted-authors)))
\r
98 + ;; Need to save the match data to avoid interfering with
\r
99 + ;; `notmuch-search-process-filter'.
\r
101 + (if (string-match "\\(.*\\)|\\(..*\\)" truncated-string)
\r
102 + (concat (match-string 1 truncated-string) ","
\r
103 + (propertize (match-string 2 truncated-string)
\r
104 + 'face 'notmuch-search-non-matching-authors))
\r
105 + truncated-string)))))
\r
107 (defun notmuch-search-insert-field (field date count authors subject tags)
\r
109 ((string-equal field "date")
\r
110 @@ -583,13 +611,7 @@ matching will be applied."
\r
111 ((string-equal field "count")
\r
112 (insert (format (cdr (assoc field notmuch-search-result-format)) count)))
\r
113 ((string-equal field "authors")
\r
114 - (insert (let* ((format-string (cdr (assoc field notmuch-search-result-format)))
\r
115 - (formatted-sample (format format-string ""))
\r
116 - (formatted-authors (format format-string authors)))
\r
117 - (if (> (length formatted-authors)
\r
118 - (length formatted-sample))
\r
119 - (concat (substring authors 0 (- (length formatted-sample) 4)) "... ")
\r
120 - formatted-authors))))
\r
121 + (notmuch-search-insert-authors (cdr (assoc field notmuch-search-result-format)) authors))
\r
122 ((string-equal field "subject")
\r
123 (insert (format (cdr (assoc field notmuch-search-result-format)) subject)))
\r
124 ((string-equal field "tags")
\r