diff options
author | Mattias EngdegÄrd <mattiase@acm.org> | 2021-08-20 18:19:43 +0200 |
---|---|---|
committer | Mattias EngdegÄrd <mattiase@acm.org> | 2021-08-21 12:41:54 +0200 |
commit | 6993d45e519ad7504adcf5a00842114ce8b25110 (patch) | |
tree | 202b9e5e962404058e8ac2288d1590b6ffb4dd53 /lisp/progmodes/xref.el | |
parent | b4830907edb7d499f7e81d53e22fe7793a0febcb (diff) | |
download | emacs-6993d45e519ad7504adcf5a00842114ce8b25110.tar.gz emacs-6993d45e519ad7504adcf5a00842114ce8b25110.tar.bz2 emacs-6993d45e519ad7504adcf5a00842114ce8b25110.zip |
Add "Find References" to context menu (bug#50067)
The new entry appears next to "Find Definition" and like it only
appears when the context menu was invoked on an identifier.
* lisp/progmodes/prog-mode.el (prog-context-menu): New menu entry.
* lisp/progmodes/xref.el (xref-find-references-at-mouse): New
function, analogous to `xref-find-definitions-at-mouse`.
Diffstat (limited to 'lisp/progmodes/xref.el')
-rw-r--r-- | lisp/progmodes/xref.el | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 32fe6b612b3..a8bab47ea25 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -1355,6 +1355,20 @@ This command is intended to be bound to a mouse event." (xref-find-definitions identifier) (user-error "No identifier here")))) +;;;###autoload +(defun xref-find-references-at-mouse (event) + "Find references to the 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 + (let ((xref-prompt-for-identifier nil)) + (xref-find-references identifier)) + (user-error "No identifier here")))) + (declare-function apropos-parse-pattern "apropos" (pattern)) ;;;###autoload |