emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 455a236: New function 'xref-find-definitions-at-mou


From: Eli Zaretskii
Subject: [Emacs-diffs] master 455a236: New function 'xref-find-definitions-at-mouse'
Date: Sat, 7 Jul 2018 05:00:51 -0400 (EDT)

branch: master
commit 455a236d415d3ca9a25564cd3f295f5e5e0bb7b4
Author: Tobias Gerdin <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    New function 'xref-find-definitions-at-mouse'
    
    * lisp/progmodes/xref.el (xref-find-definitions-at-mouse): New
    function.  (Bug32029)
    
    Copyright-paperwork-exempt: yes
---
 lisp/progmodes/xref.el | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 9a437b6..7bd1668 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -873,6 +873,19 @@ With prefix argument, prompt for the identifier."
   (interactive (list (xref--read-identifier "Find references of: ")))
   (xref--find-xrefs identifier 'references identifier nil))
 
+;;;###autoload
+(defun xref-find-definitions-at-mouse (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
+         (save-excursion
+           (mouse-set-point event)
+           (xref-backend-identifier-at-point (xref-find-backend)))))
+    (if identifier
+        (xref-find-definitions identifier)
+      (user-error "No identifier here"))))
+
 (declare-function apropos-parse-pattern "apropos" (pattern))
 
 ;;;###autoload



reply via email to

[Prev in Thread] Current Thread [Next in Thread]