Subject: Re: bug#50906: xref-find-references blocks Emacs: asynchronous operation?

From: Dmitry Gutov <[email-masked]>
Date: Tue, 5 Oct 2021 22:24:26 +0300

On 05.10.2021 21:09, Helmut Eller wrote:

>> We'd still need to choose between sorting the results and
>> saving on parsing the output buffer eagerly, though.
> 
> Theoretically it should be possible to sort the first chunk and display
> it.  Then, when the next chunk arrives, merge it in, à la heap-sort, and
> update the display accordingly.  Probably not worth the effort, though.

This will lead to "jumping" of groups up and down. Not a pleasant UX.

> Also, I think that the only "sorting" that we actually do, is grouping
> by filename.  And that doesn't seem all that important to me.

xref-matches-in-files sorts results by filename alphabetically, because 
ripgrep returns them in random order every time. And the sorting step is 
pretty fast, as long as all results are available.