GNU bug report logs - #32029
PATCH: xref-find-definitions-at-mouse

Previous Next

Package: emacs;

Reported by: Tobias Gerdin <tgerdin <at> gmail.com>

Date: Sun, 1 Jul 2018 23:52:01 UTC

Severity: wishlist

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Tobias Gerdin <tgerdin <at> gmail.com>, 32029 <at> debbugs.gnu.org
Subject: bug#32029: PATCH: xref-find-definitions-at-mouse
Date: Tue, 3 Jul 2018 16:15:31 +0300
On 7/2/18 2:18 AM, Tobias Gerdin wrote:

> +;;;###autoload
> +(defun xref-find-definitions-at-mouse (event)
> +  "Find the definition of identifier around mouse click."
> +  (interactive "e")
> +  (let* ((backend (xref-find-backend))
> +     (identifier (save-excursion
> +              (mouse-set-point event)
> +              (xref-backend-identifier-at-point backend))))
> +    (if identifier
> +    (xref--find-definitions identifier nil)
> +      (user-error "No identifier here"))))

You should call `mouse-set-point` before `xref-find-backend`, because 
the latter might conceivably depend on the value of point.

I think this can be written much shorter (call mouse-set-point, then 
interactively call xref-find-definitions), but I'm not sure how.





This bug report was last modified 7 years and 35 days ago.

Previous Next


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