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 47A1C431FC0
\r
6 for <notmuch@notmuchmail.org>; Thu, 13 Dec 2012 05:09:48 -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 VnSvku5RQbND for <notmuch@notmuchmail.org>;
\r
17 Thu, 13 Dec 2012 05:09:46 -0800 (PST)
\r
18 Received: from mail-we0-f181.google.com (mail-we0-f181.google.com
\r
19 [74.125.82.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 2A975431FBC
\r
22 for <notmuch@notmuchmail.org>; Thu, 13 Dec 2012 05:09:41 -0800 (PST)
\r
23 Received: by mail-we0-f181.google.com with SMTP id t11so841434wey.26
\r
24 for <notmuch@notmuchmail.org>; Thu, 13 Dec 2012 05:09:40 -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=7Q37wE1A2DC/XhUazCV9dbb7wiAzjrF4S0Dnj7ntFyU=;
\r
28 b=sIx48tqqWdh/Vn9USP7MS4KFx++O1cAzq8JmZCjTcTZb9vuItU8l2WiL6GJJzHAAsA
\r
29 oVtKXEQDEg9X5i49Bo+2WHQDWWkaJm8nt/rx4pT2gPmHCdqHyQV8sQR/k7dzNBe4Bjri
\r
30 7o7lbYHc8yNpKga1p7vUnhMZevaOuKV6m4v45UkdvsJNv3vxFjVJaPnBS8waCEWKCAWd
\r
31 xBjMqJJa+qip8ZsIe/m60XQl4yXf56cpSMubklOZ7pP2isyi9ofMl0oC+mFLSWES+J71
\r
32 Is26wMt1M+Ts1uUL0SBovcunXaGOEXOvJKNbkrMktRKiuQltz/AZNeD3/wnUnYZLye6Y
\r
34 Received: by 10.180.73.80 with SMTP id j16mr3279193wiv.5.1355404179948;
\r
35 Thu, 13 Dec 2012 05:09:39 -0800 (PST)
\r
36 Received: from luz3.lille.inria.fr ([193.51.236.232])
\r
37 by mx.google.com with ESMTPS id bz12sm2504214wib.5.2012.12.13.05.09.38
\r
38 (version=TLSv1/SSLv3 cipher=OTHER);
\r
39 Thu, 13 Dec 2012 05:09:39 -0800 (PST)
\r
40 From: Damien Cassou <damien.cassou@gmail.com>
\r
41 To: notmuch@notmuchmail.org
\r
42 Subject: [PATCH 3/4] emacs: Make all tags in `notmuch-show' clickable
\r
43 Date: Thu, 13 Dec 2012 14:09:26 +0100
\r
44 Message-Id: <1355404167-31750-4-git-send-email-damien.cassou@gmail.com>
\r
45 X-Mailer: git-send-email 1.7.10.4
\r
46 In-Reply-To: <1355404167-31750-1-git-send-email-damien.cassou@gmail.com>
\r
47 References: <1355404167-31750-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: Thu, 13 Dec 2012 13:09:49 -0000
\r
62 Signed-off-by: Damien Cassou <damien.cassou@gmail.com>
\r
64 emacs/notmuch-show.el | 15 +++++++--------
\r
65 emacs/notmuch-tagger.el | 33 +++++++++++++++++++++++++++++++++
\r
66 2 files changed, 40 insertions(+), 8 deletions(-)
\r
68 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
69 index 9c5a85e..8c07a00 100644
\r
70 --- a/emacs/notmuch-show.el
\r
71 +++ b/emacs/notmuch-show.el
\r
72 @@ -362,10 +362,8 @@ operation on the contents of the current buffer."
\r
73 (goto-char (notmuch-show-message-top))
\r
74 (if (re-search-forward "(\\([^()]*\\))$" (line-end-position) t)
\r
75 (let ((inhibit-read-only t))
\r
76 - (replace-match (concat "("
\r
77 - (propertize (mapconcat 'identity tags " ")
\r
78 - 'face 'notmuch-tag-face)
\r
80 + (replace-match (propertize (notmuch-tagger-format-tags tags)
\r
81 + 'face 'notmuch-tag-face)))))
\r
82 (unless no-headerline-update
\r
83 (notmuch-show-update-header-line)))
\r
85 @@ -443,10 +441,11 @@ message at DEPTH in the current thread."
\r
86 (notmuch-show-clean-address (plist-get headers :From))
\r
90 - (propertize (mapconcat 'identity tags " ")
\r
91 - 'face 'notmuch-tag-face)
\r
95 + (notmuch-tagger-format-tags tags)
\r
96 + 'face 'notmuch-tag-face)
\r
98 (overlay-put (make-overlay start (point)) 'face 'notmuch-message-summary-face)))
\r
100 (defun notmuch-show-insert-header (header header-value)
\r
101 diff --git a/emacs/notmuch-tagger.el b/emacs/notmuch-tagger.el
\r
102 index 38b858a..35b81ca 100644
\r
103 --- a/emacs/notmuch-tagger.el
\r
104 +++ b/emacs/notmuch-tagger.el
\r
105 @@ -44,12 +44,21 @@ test if the library is present before calling this function."
\r
106 (let ((tag (header-button-get button 'notmuch-tagger-tag)))
\r
107 (notmuch-tagger-goto-target tag)))
\r
109 +(defun notmuch-tagger-body-button-action (button)
\r
110 + "Open `notmuch-search' for the tag referenced by BUTTON."
\r
111 + (let ((tag (button-get button 'notmuch-tagger-tag)))
\r
112 + (notmuch-tagger-goto-target tag)))
\r
114 (eval-after-load "header-button"
\r
115 '(define-button-type 'notmuch-tagger-header-button-type
\r
117 'action #'notmuch-tagger-header-button-action
\r
120 +(define-button-type 'notmuch-tagger-body-button-type
\r
121 + 'action #'notmuch-tagger-body-button-action
\r
124 (defun notmuch-tagger-really-make-header-link (tag)
\r
125 "Return a property list that presents a link to TAG.
\r
127 @@ -73,6 +82,20 @@ if not."
\r
128 (notmuch-tagger-really-make-header-link tag)
\r
131 +(defun notmuch-tagger-make-body-link (tag)
\r
132 + "Return a property list that presents a link to TAG.
\r
133 +The returned property list will not work in the header-line. For
\r
134 +a link that works on the header-line, prefer
\r
135 +`notmuch-tagger-make-header-link'."
\r
136 + (let ((button (copy-sequence tag)))
\r
137 + (make-text-button
\r
139 + 'type 'notmuch-tagger-body-button-type
\r
140 + 'notmuch-tagger-tag tag
\r
141 + 'skip t ;; don't stop when using TAB
\r
142 + 'help-echo (format "%s: Search other messages like this" tag))
\r
145 (defun notmuch-tagger-format-tags-header-line (tags)
\r
146 "Format TAGS as a `mode-line-format' template.
\r
147 The result is suitable for inclusion in `header-line-format'."
\r
148 @@ -83,5 +106,15 @@ The result is suitable for inclusion in `header-line-format'."
\r
152 +(defun notmuch-tagger-format-tags (tags)
\r
153 + "Format TAGS as a string suitable for insertion in a buffer.
\r
154 +If the result of this function is to be used within the
\r
155 +header-line, prefer `notmuch-tagger-format-tags-header-line'
\r
156 +instead of this function."
\r
159 + (mapconcat #'notmuch-tagger-make-body-link tags " ")
\r
162 (provide 'notmuch-tagger)
\r
163 ;;; notmuch-tagger.el ends here
\r