Subject: bug#71435: closed (Re: bug#71435: interactive xref-find-definitions-at-mouse)

From: [email-masked] (GNU bug Tracking System)
Date: Mon, 10 Jun 2024 19:41:02 +0000

Your bug report

#71435: interactive xref-find-definitions-at-mouse

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
71435: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=71435
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#71435: interactive xref-find-definitions-at-mouse
From: Stefan Kangas <[email-masked]>
To: Alan Donovan <[email-masked]>, Philip Kaludercic <[email-masked]>
Cc: Eli Zaretskii <[email-masked]>, [email-masked], [email-masked]
Date: Mon, 10 Jun 2024 11:59:05 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

Alan Donovan <[email-masked]> writes:

> On Mon, 10 Jun 2024 at 13:43, Philip Kaludercic <[email-masked]> wrote:
>
>> Given that I have a working Go setup installed, I tried this out: With
>> Emacs 30 on GNU/Linux fmt and Println both jump to the correct location.
>>
>> The most recent commit might have fixed the issue you are having:
>
> I applied that neat little patch, and it fixed it. Many thanks, and sorry
> to take your time.

Thanks for testing.

I'm consequently closing this bug report.

Subject: interactive xref-find-definitions-at-mouse
From: Alan Donovan <[email-masked]>
To: [email-masked]
Date: Sat, 8 Jun 2024 11:28:34 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

Many editors allow a mouse-click operation on an identifier, plus a
suitable modifier key, to jump to the declaration of the symbol. Emacs
provides xref-find-definitions-at-mouse, but I couldn't find a way to make
it work in response to a click. So I wrote this variant that works nicely
for me. Notably, it is an (interactive) command, and it doesn't use
save-excursion.

(defun xref-find-definitions-at-mouse-2 (event)
  "Find the definition of identifier at or around mouse click.
This command is intended to be bound to a mouse event."
  (interactive "e")
  (let ((identifier
          (progn
           (mouse-set-point event)
           (xref-backend-identifier-at-point (xref-find-backend)))))
    (if identifier
       (xref-find-definitions identifier)
      (user-error "No identifier here"))))

;; cmd-click -> jump to definition
(global-set-key (kbd "s-<mouse-1>") #'xref-find-definitions-at-mouse-2)

Could this functionality (not necessarily this code) be added to
Emacs's xref package? I am not enough of an Emacs expert to know whether I
was simply "holding it wrong", so perhaps this is merely a documentation
problem.

thanks
alan