GNU bug report logs -
#71435
interactive xref-find-definitions-at-mouse
Previous Next
Reported by: Alan Donovan <adonovan <at> google.com>
Date: Sat, 8 Jun 2024 15:32:02 UTC
Severity: normal
Done: Stefan Kangas <stefankangas <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your message dated Mon, 10 Jun 2024 11:59:05 -0700
with message-id <CADwFkm=G7arLoPzefLZ=L_RpjHe_4i=XgOuSX4xeXdfx34rqCw <at> mail.gmail.com>
and subject line Re: bug#71435: interactive xref-find-definitions-at-mouse
has caused the debbugs.gnu.org bug report #71435,
regarding interactive xref-find-definitions-at-mouse
to be marked as done.
(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)
--
71435: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=71435
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
[Message part 3 (text/plain, inline)]
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
[Message part 4 (text/html, inline)]
[Message part 5 (message/rfc822, inline)]
Alan Donovan <adonovan <at> google.com> writes:
> On Mon, 10 Jun 2024 at 13:43, Philip Kaludercic <philipk <at> posteo.net> 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.
This bug report was last modified 345 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.