--- /dev/null
+Return-Path: <damien.cassou@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id D526B431FDB\r
+ for <notmuch@notmuchmail.org>; Sun, 18 Nov 2012 11:19:18 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id 64WyLN0d5IW6 for <notmuch@notmuchmail.org>;\r
+ Sun, 18 Nov 2012 11:19:17 -0800 (PST)\r
+Received: from mail-wi0-f179.google.com (mail-wi0-f179.google.com\r
+ [209.85.212.179]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 39EF6431FDA\r
+ for <notmuch@notmuchmail.org>; Sun, 18 Nov 2012 11:19:17 -0800 (PST)\r
+Received: by mail-wi0-f179.google.com with SMTP id hj6so2267709wib.2\r
+ for <notmuch@notmuchmail.org>; Sun, 18 Nov 2012 11:19:16 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+ h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
+ bh=PWzkjjB+enal92bxkGbFa7NYoXWIh9AkSENoyivGXjU=;\r
+ b=jX6YvbNzjrB+aCBW8NgZHTjI06PiDadpcTQPzx2m7UWg1v1ZoYgFP4/mhqK5iSKfLQ\r
+ uXngvw+ur9yMbuvBW4pVE8K9h50bV9TUOC+TwuYq6FboeRy18TPa4fKXBtMeZjvoZqI2\r
+ ZKvdYCxjKG6UINjYK/c40rC4zScl4ShBVSqQaoejmEX5XlLaCqxucHP0ft/Gyvg8CPM9\r
+ mbuPLSIQJPY4xiw9bJ/eyOmQ7z4P6kIdgR6CeoFKodQlY7hfh8pHcVLd2Q1H7SDXdgMJ\r
+ Jq7APq/jczy5dm5GyUxqU0sji9AW2qh+b6vMJH11bvhtAoGZFitdAaJdxx3soYH1ANT8\r
+ 90Uw==\r
+Received: by 10.180.19.197 with SMTP id h5mr6008285wie.22.1353266356026;\r
+ Sun, 18 Nov 2012 11:19:16 -0800 (PST)\r
+Received: from localhost.localdomain (ble59-4-82-228-190-150.fbx.proxad.net.\r
+ [82.228.190.150])\r
+ by mx.google.com with ESMTPS id i2sm10290063wiw.3.2012.11.18.11.19.14\r
+ (version=TLSv1/SSLv3 cipher=OTHER);\r
+ Sun, 18 Nov 2012 11:19:15 -0800 (PST)\r
+From: Damien Cassou <damien.cassou@gmail.com>\r
+To: notmuch mailing list <notmuch@notmuchmail.org>\r
+Subject: [PATCH 2/4] Make tags in header-line clickable\r
+Date: Sun, 18 Nov 2012 20:18:40 +0100\r
+Message-Id: <1353266322-20318-3-git-send-email-damien.cassou@gmail.com>\r
+X-Mailer: git-send-email 1.7.10.4\r
+In-Reply-To: <1353266322-20318-1-git-send-email-damien.cassou@gmail.com>\r
+References: <1353266322-20318-1-git-send-email-damien.cassou@gmail.com>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 18 Nov 2012 19:19:19 -0000\r
+\r
+Signed-off-by: Damien Cassou <damien.cassou@gmail.com>\r
+---\r
+ emacs/notmuch-tagger.el | 54 ++++++++++++++++++++++++++++++++++++++++++++++-\r
+ 1 file changed, 53 insertions(+), 1 deletion(-)\r
+\r
+diff --git a/emacs/notmuch-tagger.el b/emacs/notmuch-tagger.el\r
+index 5ca190e..19a6c7e 100644\r
+--- a/emacs/notmuch-tagger.el\r
++++ b/emacs/notmuch-tagger.el\r
+@@ -32,11 +32,63 @@\r
+ (setq first nil)\r
+ (push elt res))))\r
+ \r
++(defun notmuch-tagger-header-button-present-p ()\r
++ "Check if `header-button' can be loaded or is already loaded.\r
++\r
++`header-button' is a third-party library which facilitates the\r
++creation of links in emacs header-line. This function tries to\r
++`require' `header-button' and returns nil if and only if this\r
++fails."\r
++ (require 'header-button nil t))\r
++\r
++(defun notmuch-tagger-goto-target (tag)\r
++ "Show a `notmuch-search' buffer for the TAG."\r
++ (notmuch-search (concat "tag:" tag)))\r
++\r
++(defun notmuch-tagger-header-button-action (button)\r
++ "Open `notmuch-search' for the tag referenced by BUTTON.\r
++This function depends on the presence of the `header-button'\r
++library. Please call `notmuch-tagger-header-button-present-p' to\r
++test if the library is present before calling this function."\r
++ (let ((tag (header-button-get button 'notmuch-tagger-tag)))\r
++ (notmuch-tagger-goto-target tag)))\r
++\r
++(eval-after-load "header-button"\r
++ '(define-button-type 'notmuch-tagger-header-button-type\r
++ 'supertype 'header\r
++ 'action #'notmuch-tagger-header-button-action\r
++ 'follow-link t))\r
++\r
++(defun notmuch-tagger-really-make-header-link (tag)\r
++ "Return a property list that presents a link to TAG.\r
++\r
++The returned property list will only work in the header-line.\r
++Additionally, this function depends on the presence of the\r
++`header-button' library. Please call\r
++`notmuch-tagger-header-button-present-p' to test if library is\r
++present before calling this function."\r
++ (header-button-format\r
++ tag\r
++ :type 'notmuch-tagger-header-button-type\r
++ 'notmuch-tagger-tag tag\r
++ 'help-echo (format "%s: Search other messages like this" tag)))\r
++\r
++(defun notmuch-tagger-make-header-link (tag)\r
++ "Return a property list to present TAG as a link to search.\r
++\r
++This only works if `header-button' is loaded. Simply returns tag\r
++if not."\r
++ (if (notmuch-tagger-header-button-present-p)\r
++ (notmuch-tagger-really-make-header-link tag)\r
++ tag))\r
++\r
+ (defun notmuch-tagger-present-tags-header-line (tags)\r
+ "Return a property list to present TAGS in emacs header-line."\r
+ (list\r
+ "("\r
+- (notmuch-tagger-separate-elems tags " ")\r
++ (notmuch-tagger-separate-elems\r
++ (mapcar #'notmuch-tagger-make-header-link tags)\r
++ " ")\r
+ ")"))\r
+ \r
+ \r
+-- \r
+1.7.10.4\r
+\r