Subject: Re: bug#65830: 29.1; Mouse click on xref buffer doesn't go to reference

From: Eli Zaretskii <[email-masked]>
Date: Sat, 09 Sep 2023 09:11:41 +0300

merge 65830 658301
thanks

> Date: Fri, 08 Sep 2023 12:29:08 -0700
> From: "Evan Moses" <[email-masked]>
> 
> I apologize, as written that function doesn't work, but this does:

This message created a new bug report, so I'm now merging them.

> (defun my:xref-goto-xref-mouse (event &optional quit)
>   (interactive "eP")
>   (let ((xref-buffer)
>         (xref (save-excursion
>                 (mouse-set-point event)
>                 (setq xref-buffer (current-buffer))
>                 (xref--item-at-point))))
>     (if (not xref)
>       (user-error "Choose a reference to visit")
>       (progn
>         (xref--set-arrow)
>         (xref--show-location (xref-item-location xref) (if quit 'quit t))
>         (next-error-found-buffer xref-buffer)))))
> 
> (bind-key [mouse-2] #'my:xref-goto-xref-mouse xref--button-map)