1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

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`.
This commit is contained in:
Mattias Engdegård 2021-08-20 18:19:43 +02:00
parent b4830907ed
commit 6993d45e51
2 changed files with 24 additions and 2 deletions

View file

@ -52,13 +52,21 @@
(mouse-set-point last-input-event)
(xref-backend-identifier-at-point
(xref-find-backend)))
:help "Find definition of function or variable")
:help "Find definition of identifier")
'prog-separator)
(define-key-after menu [xref-find-ref]
'(menu-item "Find References" xref-find-references-at-mouse
:visible (save-excursion
(mouse-set-point last-input-event)
(xref-backend-identifier-at-point
(xref-find-backend)))
:help "Find references to identifier")
'xref-find-def)
(define-key-after menu [xref-pop]
'(menu-item "Back Definition" xref-pop-marker-stack
:visible (not (xref-marker-stack-empty-p))
:help "Back to the position of the last search")
'xref-find-def)
'xref-find-ref)
menu)
(defvar prog-mode-map