Subject: bug#23223: 25.0.92; Can xref-find-references be sped up?

From: Dmitry Gutov <[email-masked]>
Date: Wed, 6 Apr 2016 03:37:39 +0300

On 04/05/2016 06:16 PM, Eli Zaretskii wrote:

> The important part of the Lisp-level profile appears below.  It looks
> like we are visiting each match of each file in the list of matches,
> and that takes most of the time.  Can this be avoided somehow?  The
> 'lid' command already includes all the matches in Grep format, so why
> are we visiting each match, when the information should be already
> available?

Huh, yes, that's the area of optimization I've forgotten about (mostly 
because of using plain Grep myself anyway). If id-utils (and some other 
tools we delegate to) know symbol boundaries, maybe we don't need to 
double-check.

However, Grep output, which 'lid --result=grep' also uses, only outputs 
the line number, but not the starting column.

Take this example:

I'm searching for 'buffer'. The last line of the output looks like this:

xmenu.c:832:      set_buffer_internal_1 (XBUFFER (buffer));

How do I find the appropriate 'buffer' match in this line?

Or can we ask 'lid' (and, ideally, Grep too) to include the column of a 
match in the output? And when there are several matches on the same 
line, output that line multiple times?

Grep has colorized output, so I should be able to work with that. But 
not 'lid', it seems.