Subject: bug#50067: Context menus

From: Dmitry Gutov <[email-masked]>
Date: Sat, 21 Aug 2021 02:31:53 +0300

Hi Mattias!

On 20.08.2021 20:06, Mattias Engdegård wrote:
> * 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?

I wonder what could be the reason for that. It would seem the menu 
should handle autoloaded commands fine. Even the visibility predicate 
should work: xref-find-backend is autoloaded as well.

Try rewriting it with a let, to ensure that xref-find-backend is called 
first:

(let ((backend (xref-find-backend)))
   (xref-backend-identifier-at-point backend))

> * `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.

Makes sense to me, seems like an accident. I've done this change 
locally, no obvious bugs fell out.