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 183C040DBC8 for ; Mon, 15 Nov 2010 05:50:50 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.9 X-Spam-Level: X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001] autolearn=ham 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 i0L-K7IhFUbd for ; Mon, 15 Nov 2010 05:50:39 -0800 (PST) Received: from mail-ww0-f41.google.com (mail-ww0-f41.google.com [74.125.82.41]) by olra.theworths.org (Postfix) with ESMTP id 964C640DBD4 for ; Mon, 15 Nov 2010 05:50:39 -0800 (PST) Received: by wwe15 with SMTP id 15so161683wwe.2 for ; Mon, 15 Nov 2010 05:50:38 -0800 (PST) Received: by 10.216.182.75 with SMTP id n53mr6309808wem.41.1289829038683; Mon, 15 Nov 2010 05:50:38 -0800 (PST) Received: from ut.hh.sledj.net (host81-149-164-25.in-addr.btopenworld.com [81.149.164.25]) by mx.google.com with ESMTPS id x23sm3700510weq.34.2010.11.15.05.50.32 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 15 Nov 2010 05:50:33 -0800 (PST) Received: by ut.hh.sledj.net (Postfix, from userid 1000) id 26C50594056; Mon, 15 Nov 2010 13:48:17 +0000 (GMT) From: David Edmondson To: notmuch@notmuchmail.org Subject: [PATCH 1/2] emacs: Turn id:message-id text in messages into links. Date: Mon, 15 Nov 2010 13:48:14 +0000 Message-Id: <1289828895-7594-1-git-send-email-dme@dme.org> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <87wroeya0o.fsf@ut.hh.sledj.net> References: <87wroeya0o.fsf@ut.hh.sledj.net> 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: Mon, 15 Nov 2010 13:50:50 -0000 The links simply run `(notmuch-search "id:message-id")'. --- emacs/notmuch-wash.el | 30 ++++++++++++++++++++++++++++++ 1 files changed, 30 insertions(+), 0 deletions(-) diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el index a7ea5e9..f2755ae 100644 --- a/emacs/notmuch-wash.el +++ b/emacs/notmuch-wash.el @@ -288,4 +288,34 @@ for error." ;; +(require 'goto-addr) + +(defvar goto-address-mail-regexp) ; From goto-addr.el. + +(defun notmuch-wash-button-link-follow (button) + (let ((link (button-get button 'link))) + (when link + (notmuch-search link)))) + +(define-button-type 'notmuch-wash-button-link + 'action 'notmuch-wash-button-link-follow + 'help-echo "mouse-1, RET: Search for matching messages" + 'follow-link t + 'face 'font-lock-comment-face) + +(defun notmuch-wash-add-notmuch-links (depth) + "Convert notmuch message ids into search buttons." + (goto-char (point-min)) + (while (re-search-forward (concat "id:" goto-address-mail-regexp) nil t) + (let* ((start (match-beginning 0)) + (end (match-end 0)) + (link (buffer-substring start end))) + (goto-char start) + (delete-region start end) + (insert-button link + 'link link + :type 'notmuch-wash-button-link) + (goto-char end)))) +;; + (provide 'notmuch-wash) -- 1.7.2.3