* [PATCH 1/2] emacs: Turn id:message-id text in messages into links.
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
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
2 siblings, 0 replies; 6+ messages in thread
From: David Edmondson @ 2010-11-15 13:48 UTC (permalink / raw)
To: notmuch
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] emacs: notmuch-show-mode should force less behaviour.
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 ` [PATCH 1/2] emacs: Turn id:message-id text in messages into links David Edmondson
@ 2010-11-15 13:48 ` 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
2 siblings, 0 replies; 6+ messages in thread
From: David Edmondson @ 2010-11-15 13:48 UTC (permalink / raw)
To: notmuch
Move the enabling of `goto-address-mode' and `visual-line-mode' to
`notmuch-show-hook' in order that a user may choose to not use them.
---
emacs/notmuch-show.el | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 002c2fd..c9d086c 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -69,7 +69,14 @@ any given message."
"A list of functions called to decorate the headers listed in
`notmuch-message-headers'.")
-(defcustom notmuch-show-hook nil
+(defun notmuch-show-turn-on-goto-address-mode ()
+ (goto-address-mode t))
+
+(defun notmuch-show-turn-on-visual-line-mode ()
+ (visual-line-mode t))
+
+(defcustom notmuch-show-hook '(notmuch-show-turn-on-goto-address-mode
+ notmuch-show-turn-on-visual-line-mode)
"Functions called after populating a `notmuch-show' buffer."
:group 'notmuch
:type 'hook)
@@ -648,12 +655,6 @@ function is used. "
(notmuch-show-insert-forest
(notmuch-query-get-threads basic-args))))
- ;; Enable buttonisation of URLs and email addresses in the
- ;; buffer.
- (goto-address-mode t)
- ;; Act on visual lines rather than logical lines.
- (visual-line-mode t)
-
(run-hooks 'notmuch-show-hook))
;; Move straight to the first open message
--
1.7.2.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: id:message-id should be links [Re: [SCM] The notmuchmail.org wiki. branch, master, updated. cf29c08b8cafb56c6ac04917ac2cb1f63f6cda1b]
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 ` [PATCH 1/2] emacs: Turn id:message-id text in messages into links David Edmondson
2010-11-15 13:48 ` [PATCH 2/2] emacs: notmuch-show-mode should force less behaviour David Edmondson
@ 2010-11-15 21:46 ` Gregor Zattler
2010-11-22 22:09 ` Xavier Maillard
2 siblings, 1 reply; 6+ messages in thread
From: Gregor Zattler @ 2010-11-15 21:46 UTC (permalink / raw)
To: notmuch
Hi David,
* David Edmondson <dme@dme.org> [15. Nov. 2010]:
> On Mon, 15 Nov 2010 04:29:37 -0800 (PST), notmuch-commits-sender@notmuchmail.org (Anonymous Git Pusher (for wiki)) wrote:
>> - Log -----------------------------------------------------------------
>> commit cf29c08b8cafb56c6ac04917ac2cb1f63f6cda1b
>> Author: Gregor Zattler <telegraph@gmx.net>
>> Date: Mon Nov 15 13:29:24 2010 +0100
>>
>> request searching by clicking on id:Message-ID in notmuch-show
>
> How about the patches following this message?
With some help from David I managed to apply the patch, configure
Emacs correctly and enjoy clickable id: -searches.
Thanks a bundle.
> (If you have `goto-address-mode' enabled _and_
> `notmuch-wash-add-notmuch-links' added to
> `notmuch-show-insert-text/plain-hook' there is some amusing behaviour -
> the message-id part of the link generates a new email (as you mention on
> the wiki) but the 'id:' part follows the link :-))
Didn't check out on this one, though.
Ciao, Gregor
--
-... --- .-. . -.. ..--.. ...-.-
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: id:message-id should be links [Re: [SCM] The notmuchmail.org wiki. branch, master, updated. cf29c08b8cafb56c6ac04917ac2cb1f63f6cda1b]
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
0 siblings, 1 reply; 6+ messages in thread
From: Xavier Maillard @ 2010-11-22 22:09 UTC (permalink / raw)
To: Gregor Zattler, notmuch
Hi Gregor,
On Mon, 15 Nov 2010 22:46:57 +0100, Gregor Zattler <telegraph@gmx.net> wrote:
> Hi David,
> * David Edmondson <dme@dme.org> [15. Nov. 2010]:
> > On Mon, 15 Nov 2010 04:29:37 -0800 (PST), notmuch-commits-sender@notmuchmail.org (Anonymous Git Pusher (for wiki)) wrote:
> >> - Log -----------------------------------------------------------------
> >> commit cf29c08b8cafb56c6ac04917ac2cb1f63f6cda1b
> >> Author: Gregor Zattler <telegraph@gmx.net>
> >> Date: Mon Nov 15 13:29:24 2010 +0100
> >>
> >> request searching by clicking on id:Message-ID in notmuch-show
> >
> > How about the patches following this message?
>
> With some help from David I managed to apply the patch, configure
> Emacs correctly and enjoy clickable id: -searches.
What does "configure emacs correctly" mean exactly here ?
Thank you
/Xavier
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: id:message-id should be links [Re: [SCM] The notmuchmail.org wiki. branch, master, updated. cf29c08b8cafb56c6ac04917ac2cb1f63f6cda1b]
2010-11-22 22:09 ` Xavier Maillard
@ 2010-11-23 6:56 ` David Edmondson
0 siblings, 0 replies; 6+ messages in thread
From: David Edmondson @ 2010-11-23 6:56 UTC (permalink / raw)
To: Xavier Maillard, Gregor Zattler, notmuch
[-- Attachment #1: Type: text/plain, Size: 398 bytes --]
On Mon, 22 Nov 2010 23:09:41 +0100, Xavier Maillard <xavier@maillard.im> wrote:
> What does "configure emacs correctly" mean exactly here ?
Something along the lines of:
(setq notmuch-show-insert-text/plain-hook '(notmuch-wash-add-notmuch-links notmuch-wash-excerpt-citations)
notmuch-show-hook '(notmuch-show-turn-on-visual-line-mode))
dme.
--
David Edmondson, http://dme.org
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread