Subject: bug#50067: Context menus

From: Mattias Engdegård <[email-masked]>
Date: Fri, 20 Aug 2021 19:06:20 +0200

20 aug. 2021 kl. 09.31 skrev Juri Linkov <[email-masked]>:

> If the existing `xref-backend-identifier-at-point` can't be reused
> by adding a new optional arg `click`, then a cleaner solution
> would be to add `xref-backend-identifier-at-mouse` indeed.

`xref-backend-identifier-at-point` is a generic function implemented by each backend; a new function appears cleaner. Suggested patch attached!

More discoveries and questions:

* If I start emacs -Q and enable context-menu-mode, right-clicking on an identifier in an elisp buffer still doesn't produce the Find Definition entry, presumably because xref hasn't been loaded. Shouldn't it be arranged to be autoloaded somehow, which is how xref works when invoked by keystrokes?

* `xref-make-match` requires (contrary to its doc string) its LOCATION argument to be of type `xref-file-location`, but some backends may only be able to make an `xref-buffer-location`. Would anyone object to changing the :location slot of `xref-match-item` to have type `xref-location`? I don't see how it could hurt.