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