|
From: | Dmitry Gutov |
Subject: | bug#32029: PATCH: xref-find-definitions-at-mouse |
Date: | Tue, 3 Jul 2018 16:15:31 +0300 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 |
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.
[Prev in Thread] | Current Thread | [Next in Thread] |