Subject: bug#49731: 28.0.50; Filter xref results by filename

From: Daniel Martín <[email-masked]>
Date: Sun, 25 Jul 2021 16:58:46 +0200

Eli Zaretskii <[email-masked]> writes:

>
> I cannot see anything useful at that URL for some reason, so couldn't
> get a clear idea of what would be the result of the proposed feature.
> Can you describe it in more detail?

For example, go to
https://source.chromium.org/chromium/chromium/src/+/main:net/http/http_version.h;l=13;bpv=1;bpt=1
and click on "HttpVersion".  That'll open a lower pane with references
to the HttpVersion type in the Chromium codebase.  Imagine that you are
only interested in references from third party (vendor) libraries.  You
can click on "Type to filter by file path", type "third_party" in the
search box and you'll only see references from files that are in the
"third_party" directory, or one of its subdirectories.

Another use case is that you only want to see references to a symbol
from unit tests.  You can type "unittest" to filter the results
accordingly.  Or, if you only want to see references from header files,
you could type "\.h$".

>
> In particular, does "filtering by file names" mean you'd leave only
> some of the matches in the XREF buffer, or does it mean something
> else?

Yes, it means two things (although how the feature would work can be
discussed further):

- Only xref groups (and their items) whose title matches the regular
  expression will be preserved in the buffer.

- The part of the title that matches the regexp could be highlighted
  using a face derived from the "highlight" face, for example.

Of course, we need to make it clear that the xref buffer is being
filtered, and provide a way to return to the full list of results
(pressing "q", maybe?).