1 Return-Path: <damien.cassou@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 3EDEB431FAE
\r
6 for <notmuch@notmuchmail.org>; Tue, 11 Dec 2012 01:00:50 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id k4DExCsbhAPD for <notmuch@notmuchmail.org>;
\r
17 Tue, 11 Dec 2012 01:00:48 -0800 (PST)
\r
18 Received: from mail-wi0-f175.google.com (mail-wi0-f175.google.com
\r
19 [209.85.212.175]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id CEAF3431FAF
\r
22 for <notmuch@notmuchmail.org>; Tue, 11 Dec 2012 01:00:47 -0800 (PST)
\r
23 Received: by mail-wi0-f175.google.com with SMTP id hm11so1683809wib.2
\r
24 for <notmuch@notmuchmail.org>; Tue, 11 Dec 2012 01:00:45 -0800 (PST)
\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
\r
26 h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references
\r
27 :mime-version:content-type:content-transfer-encoding;
\r
28 bh=3on8qi4zRfLKlM7RHnKw3s1xoGgc2hlg4XiSP5dEa5A=;
\r
29 b=NzXR+1hvIA22tclHjWwap8YvGe/IaSzumcSSbvQ1sqGt8262dNN+WOWu0kDO2nAyd6
\r
30 B8ikcyQBdXHW7uCmOk+xRyIjHGpg+muK9L+YZrk2ymR4ZoQwI1d9YV+/drM+/G6JQTi6
\r
31 ZqRy0mU1c1ST/jbkSOrPlnf/qHg5fgBvF+kQToFmIhrm8TbYnNb3/zYSMGc7tKOmGUug
\r
32 mW0F/IoAmF77Y7ux0KH7GHP2kastSo1vnlWyQrjThNMUPQGuAArfDnh71aJ0E7C1GG4V
\r
33 aZ2S9SuPssGTPeseWgGSd9gGZ4vdwEQYuTSxt2nFmOKxQoEc7W6208NFxoRfs9Crngcp
\r
35 Received: by 10.216.203.165 with SMTP id f37mr364949weo.95.1355216445388;
\r
36 Tue, 11 Dec 2012 01:00:45 -0800 (PST)
\r
37 Received: from luz3.lille.inria.fr ([193.51.236.232])
\r
38 by mx.google.com with ESMTPS id b1sm15376748wix.11.2012.12.11.01.00.44
\r
39 (version=TLSv1/SSLv3 cipher=OTHER);
\r
40 Tue, 11 Dec 2012 01:00:44 -0800 (PST)
\r
41 From: Damien Cassou <damien.cassou@gmail.com>
\r
42 To: notmuch@notmuchmail.org
\r
43 Subject: [PATCH 1/4] emacs: Add a thread's tags to notmuch-show header-line
\r
44 Date: Tue, 11 Dec 2012 10:00:34 +0100
\r
45 Message-Id: <1355216437-21109-2-git-send-email-damien.cassou@gmail.com>
\r
46 X-Mailer: git-send-email 1.7.10.4
\r
47 In-Reply-To: <1355216437-21109-1-git-send-email-damien.cassou@gmail.com>
\r
48 References: <1355216437-21109-1-git-send-email-damien.cassou@gmail.com>
\r
50 Content-Type: text/plain; charset=UTF-8
\r
51 Content-Transfer-Encoding: 8bit
\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: Tue, 11 Dec 2012 09:00:50 -0000
\r
66 Signed-off-by: Damien Cassou <damien.cassou@gmail.com>
\r
68 emacs/notmuch-lib.el | 11 +++++++++--
\r
69 emacs/notmuch-show.el | 27 +++++++++++++++++++++++----
\r
70 emacs/notmuch-tagger.el | 35 +++++++++++++++++++++++++++++++++++
\r
71 3 files changed, 67 insertions(+), 6 deletions(-)
\r
72 create mode 100644 emacs/notmuch-tagger.el
\r
74 diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
\r
75 index 9c4ee71..3541bb7 100644
\r
76 --- a/emacs/notmuch-lib.el
\r
77 +++ b/emacs/notmuch-lib.el
\r
78 @@ -603,8 +603,15 @@ left it."
\r
79 ;; Clear out what we've parsed
\r
80 (delete-region (point-min) (point))))
\r
84 +(defun notmuch-intersperse (list sep)
\r
85 + "Return a list with all elements of LIST separated by SEP."
\r
88 + (dolist (elt list (nreverse res))
\r
94 (provide 'notmuch-lib)
\r
96 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
97 index 7d9f8a9..a71497a 100644
\r
98 --- a/emacs/notmuch-show.el
\r
99 +++ b/emacs/notmuch-show.el
\r
101 (require 'notmuch-mua)
\r
102 (require 'notmuch-crypto)
\r
103 (require 'notmuch-print)
\r
104 +(require 'notmuch-tagger)
\r
106 (declare-function notmuch-call-notmuch-process "notmuch" (&rest args))
\r
107 (declare-function notmuch-fontify-headers "notmuch" nil)
\r
108 @@ -364,7 +365,8 @@ operation on the contents of the current buffer."
\r
109 (replace-match (concat "("
\r
110 (propertize (mapconcat 'identity tags " ")
\r
111 'face 'notmuch-tag-face)
\r
114 + (notmuch-show-update-header-line))
\r
116 (defun notmuch-clean-address (address)
\r
117 "Try to clean a single email ADDRESS for display. Return a cons
\r
118 @@ -1136,11 +1138,28 @@ function is used."
\r
120 (jit-lock-register #'notmuch-show-buttonise-links)
\r
122 - ;; Set the header line to the subject of the first message.
\r
123 - (setq header-line-format (notmuch-show-strip-re (notmuch-show-get-subject)))
\r
125 + (notmuch-show-update-header-line)
\r
126 (run-hooks 'notmuch-show-hook))))
\r
128 +(defun notmuch-show-thread-tags ()
\r
129 + "Return the list of tags for the current thread."
\r
130 + (let ((tags (list)))
\r
131 + (notmuch-show-mapc (lambda ()
\r
132 + (mapcar (lambda (elt)
\r
133 + ;; Avoid adding duplicate tags
\r
134 + (add-to-list 'tags elt))
\r
135 + (notmuch-show-get-tags))))
\r
138 +(defun notmuch-show-update-header-line ()
\r
139 + "Make the header-line show the thread's subject and tags."
\r
140 + (let ((thread-subject (notmuch-show-strip-re (notmuch-show-get-subject))))
\r
141 + (setq header-line-format
\r
145 + (notmuch-tagger-format-tags-header-line (notmuch-show-thread-tags))))))
\r
147 (defun notmuch-show-capture-state ()
\r
148 "Capture the state of the current buffer.
\r
150 diff --git a/emacs/notmuch-tagger.el b/emacs/notmuch-tagger.el
\r
151 new file mode 100644
\r
152 index 0000000..6fcebff
\r
154 +++ b/emacs/notmuch-tagger.el
\r
156 +;; notmuch-tagger.el --- Library to improve the way tags are displayed
\r
158 +;; Copyright © Damien Cassou
\r
160 +;; This file is part of Notmuch.
\r
162 +;; Notmuch is free software: you can redistribute it and/or modify it
\r
163 +;; under the terms of the GNU General Public License as published by
\r
164 +;; the Free Software Foundation, either version 3 of the License, or
\r
165 +;; (at your option) any later version.
\r
167 +;; Notmuch is distributed in the hope that it will be useful, but
\r
168 +;; WITHOUT ANY WARRANTY; without even the implied warranty of
\r
169 +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
\r
170 +;; General Public License for more details.
\r
172 +;; You should have received a copy of the GNU General Public License
\r
173 +;; along with Notmuch. If not, see <http://www.gnu.org/licenses/>.
\r
175 +;; Authors: Damien Cassou <damien.cassou@gmail.com>
\r
181 +(defun notmuch-tagger-format-tags-header-line (tags)
\r
182 + "Format TAGS as a `mode-line-format' template.
\r
183 +The result is suitable for inclusion in `header-line-format'."
\r
186 + (notmuch-intersperse tags " ")
\r
189 +(provide 'notmuch-tagger)
\r
190 +;;; notmuch-tagger.el ends here
\r