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

Austin Clements amdragon at MIT.EDU
Sun Jan 6 23:04:14 PST 2013


On Wed, 19 Dec 2012, Mark Walters <markwalters1009 at gmail.com> wrote:
> 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.

Personally I prefer that point move to the clicked window, as this patch
does.  The fact that it's even possible for point not to move to the
clicked window I find strange.

> ---
>
> 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))))

Better would be (posn-window (event-start event)).  If you use the
accessors, I don't think the let bindings are really necessary since the
code becomes self-documenting.

> +					     (select-window window)
> +					     (notmuch-show ,(third link))))

Would it be better to (button-activate arg) so you don't have to
duplicate the action code?  (Then you also wouldn't need the
quasiquoting and unquoting.)

>  			  'follow-link t
>  			  'help-echo "Mouse-1, RET: search for this message"
>  			  'face goto-address-mail-face)))))
> -- 
> 1.7.9.1
>
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


More information about the notmuch mailing list