From 96ab0d21f8baccbc49878ed76847d3c896184549 Mon Sep 17 00:00:00 2001 From: Damien Cassou Date: Sun, 18 Nov 2012 20:18:41 +0100 Subject: [PATCH] [PATCH 3/4] emacs: Make tags that appear in `notmuch-show' clickable --- c3/ff3c9f7d7b97859fd64c55c73919c9d3b1e073 | 155 ++++++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 c3/ff3c9f7d7b97859fd64c55c73919c9d3b1e073 diff --git a/c3/ff3c9f7d7b97859fd64c55c73919c9d3b1e073 b/c3/ff3c9f7d7b97859fd64c55c73919c9d3b1e073 new file mode 100644 index 000000000..042e59577 --- /dev/null +++ b/c3/ff3c9f7d7b97859fd64c55c73919c9d3b1e073 @@ -0,0 +1,155 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 6E9E3431FBD + for ; Sun, 18 Nov 2012 11:19:20 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.799 +X-Spam-Level: +X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id NTRMLS0beBec for ; + Sun, 18 Nov 2012 11:19:18 -0800 (PST) +Received: from mail-wg0-f41.google.com (mail-wg0-f41.google.com + [74.125.82.41]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client + certificate requested) by olra.theworths.org (Postfix) with ESMTPS id + 9B5D0431FD9 for ; Sun, 18 Nov 2012 11:19:18 -0800 + (PST) +Received: by mail-wg0-f41.google.com with SMTP id ds1so859565wgb.2 + for ; Sun, 18 Nov 2012 11:19:17 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; + bh=uqTLr+lChGZ4OFtNm21p+SL8DSP28mvvERQVw8E32HU=; + b=WMp3V1fCEsAk9orVq8X3uvtQExwBemvAxv0BH8feaHjU27PK5//RiwwfpAS9zs5xzD + 2C6gQkqCI2l6OEoXZve3IVYxMqKcJhxZOzNcSiZNjx/aMuyEriRVWKuHiAv8MN0IGcVA + N9tzeqJU5A5S105C38ijpRC319eUOq3CcRK4FhwbOMcMFeJh/J6IMD9utICkNOzQkjlW + Jux1AJmQxEtKVxgIAPv+PbEDPBs1iVFr9iQQyFUSal3SkxAVSetjVa5EBADAQKieYoqm + T/gsnAFgtx8E0KkHhebTrPlo5EJsvfU9tskhRANI8O5crF9lNRGI6U5Fe7u5nQ2Gen4C + ZPsQ== +Received: by 10.216.196.202 with SMTP id r52mr2513540wen.81.1353266357332; + Sun, 18 Nov 2012 11:19:17 -0800 (PST) +Received: from localhost.localdomain (ble59-4-82-228-190-150.fbx.proxad.net. + [82.228.190.150]) + by mx.google.com with ESMTPS id i2sm10290063wiw.3.2012.11.18.11.19.16 + (version=TLSv1/SSLv3 cipher=OTHER); + Sun, 18 Nov 2012 11:19:16 -0800 (PST) +From: Damien Cassou +To: notmuch mailing list +Subject: [PATCH 3/4] emacs: Make tags that appear in `notmuch-show' clickable +Date: Sun, 18 Nov 2012 20:18:41 +0100 +Message-Id: <1353266322-20318-4-git-send-email-damien.cassou@gmail.com> +X-Mailer: git-send-email 1.7.10.4 +In-Reply-To: <1353266322-20318-1-git-send-email-damien.cassou@gmail.com> +References: <1353266322-20318-1-git-send-email-damien.cassou@gmail.com> +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sun, 18 Nov 2012 19:19:20 -0000 + +Signed-off-by: Damien Cassou +--- + emacs/notmuch-show.el | 9 +++++---- + emacs/notmuch-tagger.el | 33 +++++++++++++++++++++++++++++++++ + 2 files changed, 38 insertions(+), 4 deletions(-) + +diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +index 988e27c..379c8cd 100644 +--- a/emacs/notmuch-show.el ++++ b/emacs/notmuch-show.el +@@ -431,10 +431,11 @@ message at DEPTH in the current thread." + (notmuch-show-clean-address (plist-get headers :From)) + " (" + date +- ") (" +- (propertize (mapconcat 'identity tags " ") +- 'face 'notmuch-tag-face) +- ")\n") ++ ") " ++ (propertize ++ (format-mode-line (notmuch-tagger-present-tags tags)) ++ 'face 'notmuch-tag-face) ++ "\n") + (overlay-put (make-overlay start (point)) 'face 'notmuch-message-summary-face))) + + (defun notmuch-show-insert-header (header header-value) +diff --git a/emacs/notmuch-tagger.el b/emacs/notmuch-tagger.el +index 19a6c7e..379a905 100644 +--- a/emacs/notmuch-tagger.el ++++ b/emacs/notmuch-tagger.el +@@ -53,12 +53,21 @@ test if the library is present before calling this function." + (let ((tag (header-button-get button 'notmuch-tagger-tag))) + (notmuch-tagger-goto-target tag))) + ++(defun notmuch-tagger-body-button-action (button) ++ "Open `notmuch-search' for the tag referenced by BUTTON." ++ (let ((tag (button-get button 'notmuch-tagger-tag))) ++ (notmuch-tagger-goto-target tag))) ++ + (eval-after-load "header-button" + '(define-button-type 'notmuch-tagger-header-button-type + 'supertype 'header + 'action #'notmuch-tagger-header-button-action + 'follow-link t)) + ++(define-button-type 'notmuch-tagger-body-button-type ++ 'action #'notmuch-tagger-body-button-action ++ 'follow-link t) ++ + (defun notmuch-tagger-really-make-header-link (tag) + "Return a property list that presents a link to TAG. + +@@ -82,6 +91,19 @@ if not." + (notmuch-tagger-really-make-header-link tag) + tag)) + ++(defun notmuch-tagger-make-body-link (tag) ++ "Return a property list that presents a link to TAG. ++The returned property list will work everywhere except in the ++header-line. For a link that works on the header-line, prefer ++`notmuch-tagger-make-header-link'." ++ (let ((button (copy-sequence tag))) ++ (make-text-button ++ button nil ++ 'type 'notmuch-tagger-body-button-type ++ 'notmuch-tagger-tag tag ++ 'help-echo (format "%s: Search other messages like this" tag)) ++ button)) ++ + (defun notmuch-tagger-present-tags-header-line (tags) + "Return a property list to present TAGS in emacs header-line." + (list +@@ -91,6 +113,17 @@ if not." + " ") + ")")) + ++(defun notmuch-tagger-present-tags (tags) ++ "Return a property list to present TAGS in emacs. ++If tags the result of this function is to be used within the ++header-line, prefer `notmuch-tagger-present-tags-header-line' ++instead of this function." ++ (list ++ "(" ++ (notmuch-tagger-separate-elems ++ (mapcar #'notmuch-tagger-make-body-link tags) ++ " ") ++ ")")) + + (provide 'notmuch-tagger) + ;;; notmuch-tagger.el ends here +-- +1.7.10.4 + -- 2.26.2