diff options
| author | Tobias Gerdin | 2018-07-07 11:59:56 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2018-07-07 11:59:56 +0300 |
| commit | 455a236d415d3ca9a25564cd3f295f5e5e0bb7b4 (patch) | |
| tree | 93d746ce23f4627e5ef89ab107b6f75b19daa6a9 | |
| parent | c73cf3548e7166a4ccffc578699c394b360ed0f5 (diff) | |
| download | emacs-455a236d415d3ca9a25564cd3f295f5e5e0bb7b4.tar.gz emacs-455a236d415d3ca9a25564cd3f295f5e5e0bb7b4.zip | |
New function 'xref-find-definitions-at-mouse'
* lisp/progmodes/xref.el (xref-find-definitions-at-mouse): New
function. (Bug32029)
Copyright-paperwork-exempt: yes
| -rw-r--r-- | lisp/progmodes/xref.el | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 9a437b6f690..7bd1668cf4e 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el | |||
| @@ -873,6 +873,19 @@ With prefix argument, prompt for the identifier." | |||
| 873 | (interactive (list (xref--read-identifier "Find references of: "))) | 873 | (interactive (list (xref--read-identifier "Find references of: "))) |
| 874 | (xref--find-xrefs identifier 'references identifier nil)) | 874 | (xref--find-xrefs identifier 'references identifier nil)) |
| 875 | 875 | ||
| 876 | ;;;###autoload | ||
| 877 | (defun xref-find-definitions-at-mouse (event) | ||
| 878 | "Find the definition of identifier at or around mouse click. | ||
| 879 | This command is intended to be bound to a mouse event." | ||
| 880 | (interactive "e") | ||
| 881 | (let ((identifier | ||
| 882 | (save-excursion | ||
| 883 | (mouse-set-point event) | ||
| 884 | (xref-backend-identifier-at-point (xref-find-backend))))) | ||
| 885 | (if identifier | ||
| 886 | (xref-find-definitions identifier) | ||
| 887 | (user-error "No identifier here")))) | ||
| 888 | |||
| 876 | (declare-function apropos-parse-pattern "apropos" (pattern)) | 889 | (declare-function apropos-parse-pattern "apropos" (pattern)) |
| 877 | 890 | ||
| 878 | ;;;###autoload | 891 | ;;;###autoload |