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 D526B431FDB
\r
6 for <notmuch@notmuchmail.org>; Sun, 18 Nov 2012 11:19:18 -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 64WyLN0d5IW6 for <notmuch@notmuchmail.org>;
\r
17 Sun, 18 Nov 2012 11:19:17 -0800 (PST)
\r
18 Received: from mail-wi0-f179.google.com (mail-wi0-f179.google.com
\r
19 [209.85.212.179]) (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 39EF6431FDA
\r
22 for <notmuch@notmuchmail.org>; Sun, 18 Nov 2012 11:19:17 -0800 (PST)
\r
23 Received: by mail-wi0-f179.google.com with SMTP id hj6so2267709wib.2
\r
24 for <notmuch@notmuchmail.org>; Sun, 18 Nov 2012 11:19:16 -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=PWzkjjB+enal92bxkGbFa7NYoXWIh9AkSENoyivGXjU=;
\r
28 b=jX6YvbNzjrB+aCBW8NgZHTjI06PiDadpcTQPzx2m7UWg1v1ZoYgFP4/mhqK5iSKfLQ
\r
29 uXngvw+ur9yMbuvBW4pVE8K9h50bV9TUOC+TwuYq6FboeRy18TPa4fKXBtMeZjvoZqI2
\r
30 ZKvdYCxjKG6UINjYK/c40rC4zScl4ShBVSqQaoejmEX5XlLaCqxucHP0ft/Gyvg8CPM9
\r
31 mbuPLSIQJPY4xiw9bJ/eyOmQ7z4P6kIdgR6CeoFKodQlY7hfh8pHcVLd2Q1H7SDXdgMJ
\r
32 Jq7APq/jczy5dm5GyUxqU0sji9AW2qh+b6vMJH11bvhtAoGZFitdAaJdxx3soYH1ANT8
\r
34 Received: by 10.180.19.197 with SMTP id h5mr6008285wie.22.1353266356026;
\r
35 Sun, 18 Nov 2012 11:19:16 -0800 (PST)
\r
36 Received: from localhost.localdomain (ble59-4-82-228-190-150.fbx.proxad.net.
\r
38 by mx.google.com with ESMTPS id i2sm10290063wiw.3.2012.11.18.11.19.14
\r
39 (version=TLSv1/SSLv3 cipher=OTHER);
\r
40 Sun, 18 Nov 2012 11:19:15 -0800 (PST)
\r
41 From: Damien Cassou <damien.cassou@gmail.com>
\r
42 To: notmuch mailing list <notmuch@notmuchmail.org>
\r
43 Subject: [PATCH 2/4] Make tags in header-line clickable
\r
44 Date: Sun, 18 Nov 2012 20:18:40 +0100
\r
45 Message-Id: <1353266322-20318-3-git-send-email-damien.cassou@gmail.com>
\r
46 X-Mailer: git-send-email 1.7.10.4
\r
47 In-Reply-To: <1353266322-20318-1-git-send-email-damien.cassou@gmail.com>
\r
48 References: <1353266322-20318-1-git-send-email-damien.cassou@gmail.com>
\r
49 X-BeenThere: notmuch@notmuchmail.org
\r
50 X-Mailman-Version: 2.1.13
\r
52 List-Id: "Use and development of the notmuch mail system."
\r
53 <notmuch.notmuchmail.org>
\r
54 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
55 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
56 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
57 List-Post: <mailto:notmuch@notmuchmail.org>
\r
58 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
59 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
60 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
61 X-List-Received-Date: Sun, 18 Nov 2012 19:19:19 -0000
\r
63 Signed-off-by: Damien Cassou <damien.cassou@gmail.com>
\r
65 emacs/notmuch-tagger.el | 54 ++++++++++++++++++++++++++++++++++++++++++++++-
\r
66 1 file changed, 53 insertions(+), 1 deletion(-)
\r
68 diff --git a/emacs/notmuch-tagger.el b/emacs/notmuch-tagger.el
\r
69 index 5ca190e..19a6c7e 100644
\r
70 --- a/emacs/notmuch-tagger.el
\r
71 +++ b/emacs/notmuch-tagger.el
\r
76 +(defun notmuch-tagger-header-button-present-p ()
\r
77 + "Check if `header-button' can be loaded or is already loaded.
\r
79 +`header-button' is a third-party library which facilitates the
\r
80 +creation of links in emacs header-line. This function tries to
\r
81 +`require' `header-button' and returns nil if and only if this
\r
83 + (require 'header-button nil t))
\r
85 +(defun notmuch-tagger-goto-target (tag)
\r
86 + "Show a `notmuch-search' buffer for the TAG."
\r
87 + (notmuch-search (concat "tag:" tag)))
\r
89 +(defun notmuch-tagger-header-button-action (button)
\r
90 + "Open `notmuch-search' for the tag referenced by BUTTON.
\r
91 +This function depends on the presence of the `header-button'
\r
92 +library. Please call `notmuch-tagger-header-button-present-p' to
\r
93 +test if the library is present before calling this function."
\r
94 + (let ((tag (header-button-get button 'notmuch-tagger-tag)))
\r
95 + (notmuch-tagger-goto-target tag)))
\r
97 +(eval-after-load "header-button"
\r
98 + '(define-button-type 'notmuch-tagger-header-button-type
\r
99 + 'supertype 'header
\r
100 + 'action #'notmuch-tagger-header-button-action
\r
103 +(defun notmuch-tagger-really-make-header-link (tag)
\r
104 + "Return a property list that presents a link to TAG.
\r
106 +The returned property list will only work in the header-line.
\r
107 +Additionally, this function depends on the presence of the
\r
108 +`header-button' library. Please call
\r
109 +`notmuch-tagger-header-button-present-p' to test if library is
\r
110 +present before calling this function."
\r
111 + (header-button-format
\r
113 + :type 'notmuch-tagger-header-button-type
\r
114 + 'notmuch-tagger-tag tag
\r
115 + 'help-echo (format "%s: Search other messages like this" tag)))
\r
117 +(defun notmuch-tagger-make-header-link (tag)
\r
118 + "Return a property list to present TAG as a link to search.
\r
120 +This only works if `header-button' is loaded. Simply returns tag
\r
122 + (if (notmuch-tagger-header-button-present-p)
\r
123 + (notmuch-tagger-really-make-header-link tag)
\r
126 (defun notmuch-tagger-present-tags-header-line (tags)
\r
127 "Return a property list to present TAGS in emacs header-line."
\r
130 - (notmuch-tagger-separate-elems tags " ")
\r
131 + (notmuch-tagger-separate-elems
\r
132 + (mapcar #'notmuch-tagger-make-header-link tags)
\r