emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding support for xref jumping to headers/interfaces


From: Eli Zaretskii
Subject: Re: Adding support for xref jumping to headers/interfaces
Date: Fri, 24 Feb 2023 22:04:00 +0200

> From: Spencer Baugh <sbaugh@janestreet.com>
> Cc: azeng@janestreet.com
> Date: Fri, 24 Feb 2023 14:56:59 -0500
> 
> 
> xref provides support for jump-to-definition, but no support for
> jump-to-interface.  The latter would jump to the header or interface
> file for an identifier.  This functionality exists in some packages
> already because it is particularly important in some languages, and I'm
> looking for suggestions on how to expose it through xref.
> 
> For example, merlin, for OCaml, supports both jump-to-definition and
> jump-to-interface.  However, merlin's xref support only exposes
> jump-to-definition (through xref-find-definitions), because there's no
> natural way to expose jump-to-interface through xref.
> 
> It would be straightforward to extend xref with a new command
> xref-find-interfaces.  The main difficulty is picking a good UI to
> expose this command.  I've thought of a few options, but nothing that
> seems obviously correct, so I welcome opinions.
> 
> Suppose there's a new command xref-find-interfaces.  Then some options are:
> 
> 1. xref-find-interfaces could be bound by default with some new binding.
>    I'm not sure what a good binding would be.
> 
> 2. xref-find-definitions could call xref-find-interfaces if called with
>    a prefix argument.  Note that this would change the current prefix
>    argument behavior of xref-find-definitions.
> 
> 3. xref-find-definitions could call xref-find-interfaces if called after
>    some custom prefix is typed, like how other-window-prefix works.
> 
> 4. xref-find-definitions could call xref-find-interfaces if a certain
>    customization variable is set.
> 
> 5. Like option 5, but there could also be a new binding to
>    toggle that variable on and off.
> 
> I think the most satisfying of these is option 3, but maybe that's too
> unusual of an interface for core Emacs?

I think 1 is the best alternative.  C-M-? is available, AFAIK.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]