GNU bug report logs - #71435
interactive xref-find-definitions-at-mouse

Previous Next

Package: emacs;

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

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Alan Donovan <adonovan <at> google.com>
Subject: bug#71435: closed (Re: bug#71435: interactive xref-find-definitions-at-mouse)
Date: Mon, 10 Jun 2024 19:41:02 +0000
[Message part 1 (text/plain, inline)]
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 71435 <at> debbugs.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)]
From: Stefan Kangas <stefankangas <at> gmail.com>
To: Alan Donovan <adonovan <at> google.com>, Philip Kaludercic <philipk <at> posteo.net>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 71435-done <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#71435: interactive xref-find-definitions-at-mouse
Date: Mon, 10 Jun 2024 11:59:05 -0700
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.

[Message part 3 (message/rfc822, inline)]
From: Alan Donovan <adonovan <at> google.com>
To: bug-gnu-emacs <at> gnu.org
Subject: interactive xref-find-definitions-at-mouse
Date: Sat, 8 Jun 2024 11:28:34 -0400
[Message part 4 (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 5 (text/html, inline)]

This bug report was last modified 346 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.