Subject: bug#46859: 28.0.50; [PATCH]: Add option to truncate long lines in xref.el

From: Dmitry Gutov <[email-masked]>
Date: Sat, 6 Mar 2021 14:44:45 +0200

On 03.03.2021 23:06, Gregory Heytings wrote:
> 
>>
>> With your approach we'll have to deal with interpreting Grep outputs 
>> which list every line in the searched files. This will almost 
>> certainly be slower in the case when there are only handful of 
>> matches. But benchmarks welcome.
>>
> 
> I don't know what you exactly need (I don't (yet?) use project), so I 
> can't elaborate further or provide benchmarks alas.

The same code is also used in the default implementation of 
xref-find-references, in case you ever tried it.

> Could you perhaps tell me what you need?

We are discussing changes to xref.el, because project-find-regexp 
delegates a lot of its logic to it.

Check out xref-matches-in-files and xref--convert-hits which it calls at 
the end. What you're thinking of seems to require a Grep-specific 
version of xref--convert-hits logic, which in the end constructs 
specialized xref items with a new type of location (alternative to 
xref-file-location).