From: David Edmondson <dme@dme.org>
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 [thread overview]
Message-ID: <1289828895-7594-1-git-send-email-dme@dme.org> (raw)
In-Reply-To: <87wroeya0o.fsf@ut.hh.sledj.net>
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
next prev parent reply other threads:[~2010-11-15 13:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20101115122937.4525840DBD4@olra.theworths.org>
2010-11-15 13:46 ` id:message-id should be links [Re: [SCM] The notmuchmail.org wiki. branch, master, updated. cf29c08b8cafb56c6ac04917ac2cb1f63f6cda1b] David Edmondson
2010-11-15 13:48 ` David Edmondson [this message]
2010-11-15 13:48 ` [PATCH 2/2] emacs: notmuch-show-mode should force less behaviour David Edmondson
2010-11-15 21:46 ` id:message-id should be links [Re: [SCM] The notmuchmail.org wiki. branch, master, updated. cf29c08b8cafb56c6ac04917ac2cb1f63f6cda1b] Gregor Zattler
2010-11-22 22:09 ` Xavier Maillard
2010-11-23 6:56 ` David Edmondson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1289828895-7594-1-git-send-email-dme@dme.org \
--to=dme@dme.org \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).