[PATCH] emacs: show: make id links respect window

Subject: [PATCH] emacs: show: make id links respect window

Date: Wed, 19 Dec 2012 23:10:02 +0000

To: notmuch@notmuchmail.org

Cc:

From: Mark Walters


There is a bug in current notmuch: if you have multiple windows in one
frame and click an id button link in a show buffer that does not
contain point then the link is opened in the window containing point.

This reads the mouse event to make sure that the correct window is
used for the link.
---

I think this is a bug but that could be debated. It is particularly
easy to trigger with notmuch pick because that uses the split pane
while focus usually remains in the `pick' pane rather than the `show'
pane.

The lisp is not pretty but seems to work.

Best wishes

Mark




 emacs/notmuch-show.el |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 5751d98..5664ea3 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1077,6 +1077,11 @@ buttons for a corresponding notmuch search."
 	(make-text-button (first link) (second link)
 			  'action `(lambda (arg)
 				     (notmuch-show ,(third link)))
+			  'mouse-action `(lambda (arg)
+					   (let* ((event last-input-event)
+						  (window (car (cadr event))))
+					     (select-window window)
+					     (notmuch-show ,(third link))))
 			  'follow-link t
 			  'help-echo "Mouse-1, RET: search for this message"
 			  'face goto-address-mail-face)))))
-- 
1.7.9.1


Thread: