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 23DC4429E44
\r
6 for <notmuch@notmuchmail.org>; Mon, 10 Dec 2012 06:33:05 -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 rpKzDveb7hx4 for <notmuch@notmuchmail.org>;
\r
17 Mon, 10 Dec 2012 06:33:02 -0800 (PST)
\r
18 Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com
\r
19 [209.85.212.181]) (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 61F4F431FBF
\r
22 for <notmuch@notmuchmail.org>; Mon, 10 Dec 2012 06:33:00 -0800 (PST)
\r
23 Received: by mail-wi0-f181.google.com with SMTP id hm9so1097139wib.2
\r
24 for <notmuch@notmuchmail.org>; Mon, 10 Dec 2012 06:33:00 -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 bh=ZEH1qDEaC8A+Toui4CRNuiQy4YjscE/X+J82D6PYhvA=;
\r
28 b=dkWKEF2Lm4NxyzBquUhtJfTlLiz4gW9vjhS0Uypu71xp2KIeAk5L7ZmQiKrOHCyKMp
\r
29 z+qvb3EtdW+vaKd04QxpVpoRsF3KeLgy82qzzGMVrHp2kJJqzzQ/GM0OEVmgp7wmbdJ5
\r
30 URcFAl/9mr1loMUcmKpX5zQsdHTTItMs8XbKCrw3BLG702j2ZI6i3fE35D78STbO+s6d
\r
31 gXN7b87Q1Kdu6eks07tHQlitLfretRjhdlIzZ5CiIiulvmO2rYz73fyxSjuXZ2Jeahvq
\r
32 lyvTmibpT5Yp5FFrv+Sxh4gHfWz69ONFydPDyVA73WF71YPsyHpdb97AnFZeVeWJ3I61
\r
34 Received: by 10.180.102.234 with SMTP id fr10mr11050105wib.17.1355149980112;
\r
35 Mon, 10 Dec 2012 06:33:00 -0800 (PST)
\r
36 Received: from luz3.lille.inria.fr ([193.51.236.232])
\r
37 by mx.google.com with ESMTPS id i6sm10241253wix.5.2012.12.10.06.32.58
\r
38 (version=TLSv1/SSLv3 cipher=OTHER);
\r
39 Mon, 10 Dec 2012 06:32:59 -0800 (PST)
\r
40 From: Damien Cassou <damien.cassou@gmail.com>
\r
41 To: notmuch@notmuchmail.org
\r
42 Subject: [PATCH 2/4] emacs: Make tags in notmuch-show header-line clickable
\r
43 Date: Mon, 10 Dec 2012 15:32:42 +0100
\r
44 Message-Id: <1355149964-27905-3-git-send-email-damien.cassou@gmail.com>
\r
45 X-Mailer: git-send-email 1.7.10.4
\r
46 In-Reply-To: <1355149964-27905-1-git-send-email-damien.cassou@gmail.com>
\r
47 References: <1355149964-27905-1-git-send-email-damien.cassou@gmail.com>
\r
48 X-BeenThere: notmuch@notmuchmail.org
\r
49 X-Mailman-Version: 2.1.13
\r
51 List-Id: "Use and development of the notmuch mail system."
\r
52 <notmuch.notmuchmail.org>
\r
53 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
54 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
55 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
56 List-Post: <mailto:notmuch@notmuchmail.org>
\r
57 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
58 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
59 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
60 X-List-Received-Date: Mon, 10 Dec 2012 14:33:06 -0000
\r
62 Signed-off-by: Damien Cassou <damien.cassou@gmail.com>
\r
64 emacs/notmuch-tagger.el | 54 ++++++++++++++++++++++++++++++++++++++++++++++-
\r
65 1 file changed, 53 insertions(+), 1 deletion(-)
\r
67 diff --git a/emacs/notmuch-tagger.el b/emacs/notmuch-tagger.el
\r
68 index 6fcebff..0d4d471 100644
\r
69 --- a/emacs/notmuch-tagger.el
\r
70 +++ b/emacs/notmuch-tagger.el
\r
75 +(defun notmuch-tagger-header-button-present-p ()
\r
76 + "Check if `header-button' can be loaded or is already loaded.
\r
78 +`header-button' is a third-party library which facilitates the
\r
79 +creation of links in emacs header-line. This function tries to
\r
80 +`require' `header-button' and returns nil if and only if this
\r
82 + (require 'header-button nil t))
\r
84 +(defun notmuch-tagger-goto-target (tag)
\r
85 + "Show a `notmuch-search' buffer for the TAG."
\r
86 + (notmuch-search (concat "tag:" tag)))
\r
88 +(defun notmuch-tagger-header-button-action (button)
\r
89 + "Open `notmuch-search' for the tag referenced by BUTTON.
\r
90 +This function depends on the presence of the `header-button'
\r
91 +library. Please call `notmuch-tagger-header-button-present-p' to
\r
92 +test if the library is present before calling this function."
\r
93 + (let ((tag (header-button-get button 'notmuch-tagger-tag)))
\r
94 + (notmuch-tagger-goto-target tag)))
\r
96 +(eval-after-load "header-button"
\r
97 + '(define-button-type 'notmuch-tagger-header-button-type
\r
98 + 'supertype 'header
\r
99 + 'action #'notmuch-tagger-header-button-action
\r
102 +(defun notmuch-tagger-really-make-header-link (tag)
\r
103 + "Return a property list that presents a link to TAG.
\r
105 +The returned property list will only work in the header-line.
\r
106 +Additionally, this function depends on the presence of the
\r
107 +`header-button' library. Please call
\r
108 +`notmuch-tagger-header-button-present-p' to test if library is
\r
109 +present before calling this function."
\r
110 + (header-button-format
\r
112 + :type 'notmuch-tagger-header-button-type
\r
113 + 'notmuch-tagger-tag tag
\r
114 + 'help-echo (format "%s: Search other messages like this" tag)))
\r
116 +(defun notmuch-tagger-make-header-link (tag)
\r
117 + "Return a property list to present TAG as a link to search.
\r
119 +This only works if `header-button' is loaded. Simply returns tag
\r
121 + (if (notmuch-tagger-header-button-present-p)
\r
122 + (notmuch-tagger-really-make-header-link tag)
\r
125 (defun notmuch-tagger-format-tags-header-line (tags)
\r
126 "Format TAGS as a `mode-line-format' template.
\r
127 The result is suitable for inclusion in `header-line-format'."
\r
130 - (notmuch-intersperse tags " ")
\r
131 + (notmuch-intersperse
\r
132 + (mapcar #'notmuch-tagger-make-header-link tags)
\r
136 (provide 'notmuch-tagger)
\r