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 55D7A418C34
\r
6 for <notmuch@notmuchmail.org>; Wed, 19 May 2010 01:54:22 -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, RCVD_IN_DNSWL_NONE=-0.0001] 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 DUf7LYVmzg8R for <notmuch@notmuchmail.org>;
\r
16 Wed, 19 May 2010 01:54:08 -0700 (PDT)
\r
17 Received: from mail-ew0-f213.google.com (mail-ew0-f213.google.com
\r
19 by olra.theworths.org (Postfix) with ESMTP id 32F75418C36
\r
20 for <notmuch@notmuchmail.org>; Wed, 19 May 2010 01:53:45 -0700 (PDT)
\r
21 Received: by mail-ew0-f213.google.com with SMTP id 5so1814153ewy.0
\r
22 for <notmuch@notmuchmail.org>; Wed, 19 May 2010 01:53:44 -0700 (PDT)
\r
23 Received: by 10.213.55.76 with SMTP id t12mr3285610ebg.3.1274259224832;
\r
24 Wed, 19 May 2010 01:53:44 -0700 (PDT)
\r
25 Received: from ut.hh.sledj.net (host83-217-165-81.dsl.vispa.com
\r
27 by mx.google.com with ESMTPS id 14sm3562108ewy.14.2010.05.19.01.53.42
\r
28 (version=TLSv1/SSLv3 cipher=RC4-MD5);
\r
29 Wed, 19 May 2010 01:53:43 -0700 (PDT)
\r
30 Received: by ut.hh.sledj.net (Postfix, from userid 1000)
\r
31 id 94C1B59409C; Wed, 19 May 2010 08:03:45 +0100 (BST)
\r
32 From: David Edmondson <dme@dme.org>
\r
33 To: notmuch@notmuchmail.org
\r
34 Subject: [PATCH 04/13] emacs: Display non-matching authors with a different
\r
36 Date: Wed, 19 May 2010 08:03:31 +0100
\r
37 Message-Id: <1274252620-1249-5-git-send-email-dme@dme.org>
\r
38 X-Mailer: git-send-email 1.7.1
\r
39 In-Reply-To: <1274252620-1249-1-git-send-email-dme@dme.org>
\r
40 References: <1274252620-1249-1-git-send-email-dme@dme.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: Wed, 19 May 2010 08:54:22 -0000
\r
55 In search mode some messages don't match the search criteria. Show
\r
56 their authors names with a different face - generally darker than
\r
57 those that do match.
\r
59 emacs/notmuch.el | 36 +++++++++++++++++++++++++++++-------
\r
60 1 files changed, 29 insertions(+), 7 deletions(-)
\r
62 diff --git a/emacs/notmuch.el b/emacs/notmuch.el
\r
63 index 7457da9..60c0ee5 100644
\r
64 --- a/emacs/notmuch.el
\r
65 +++ b/emacs/notmuch.el
\r
66 @@ -297,6 +297,17 @@ For a mouse binding, return nil."
\r
67 "Notmuch search mode face used to highligh tags."
\r
70 +(defface notmuch-search-non-matching-authors
\r
72 + (background dark))
\r
73 + (:foreground "grey30"))
\r
75 + (background light))
\r
76 + (:foreground "grey60"))
\r
78 + "Face used in search mode for authors not matching the query."
\r
82 (defun notmuch-search-mode ()
\r
83 "Major mode displaying results of a notmuch search.
\r
84 @@ -576,6 +587,23 @@ matching will be applied."
\r
86 (setq tags-faces (cdr tags-faces)))))))))
\r
88 +(defun notmuch-search-insert-authors (format-string authors)
\r
89 + (insert (let* ((formatted-sample (format format-string ""))
\r
90 + (formatted-authors (format format-string authors))
\r
92 + (if (> (length formatted-authors)
\r
93 + (length formatted-sample))
\r
94 + (concat (substring authors 0 (- (length formatted-sample) 4)) "... ")
\r
95 + formatted-authors)))
\r
96 + ;; Need to save the match data to avoid interfering with
\r
97 + ;; `notmuch-search-process-filter'.
\r
99 + (if (string-match "\\(.*\\)|\\(..*\\)" truncated-string)
\r
100 + (concat (match-string 1 truncated-string) ","
\r
101 + (propertize (match-string 2 truncated-string)
\r
102 + 'face 'notmuch-search-non-matching-authors))
\r
103 + truncated-string)))))
\r
105 (defun notmuch-search-insert-field (field date count authors subject tags)
\r
107 ((string-equal field "date")
\r
108 @@ -583,13 +611,7 @@ matching will be applied."
\r
109 ((string-equal field "count")
\r
110 (insert (format (cdr (assoc field notmuch-search-result-format)) count)))
\r
111 ((string-equal field "authors")
\r
112 - (insert (let* ((format-string (cdr (assoc field notmuch-search-result-format)))
\r
113 - (formatted-sample (format format-string ""))
\r
114 - (formatted-authors (format format-string authors)))
\r
115 - (if (> (length formatted-authors)
\r
116 - (length formatted-sample))
\r
117 - (concat (substring authors 0 (- (length formatted-sample) 4)) "... ")
\r
118 - formatted-authors))))
\r
119 + (notmuch-search-insert-authors (cdr (assoc field notmuch-search-result-format)) authors))
\r
120 ((string-equal field "subject")
\r
121 (insert (format (cdr (assoc field notmuch-search-result-format)) subject)))
\r
122 ((string-equal field "tags")
\r