Subject: Re: bug#48545: 28.0.50; `icomplete-vertical-mode` does not support the `group-function`

From: Dmitry Gutov <[email-masked]>
Date: Fri, 20 Aug 2021 01:37:54 +0300

On 19.08.2021 22:41, João Távora wrote:

>> We discussed this problem when group-function was introduced. Another
>> approach is to just change the method of grouping: first the
>> completions are sorted, and then they are sorted into groups.
> 
> That's a possiblity. But it might be performing too much work, at least
> at first sight.

Not sure I understand. Grouping is a linear operation, isn't it? O(N).

Which is generally cheaper than the sorting step that came before.

> For the C-x 8 RET case and the xref table (the only
> tables I know which use this) things seem to be naturally put into
> groups already.  So sorting them alphabetically, by length, by history,
> and _then_ destroying most (but not all) with the grouping could be not
> so interesting if the there's a big a price to pay.

Could be it misses information.

OTOH, if you split completions belonging to the same group apart, you 
can end up with a list where there as as many group headers, as there 
completions (in the extreme case).

What behavior does (setq completions-group t) have? It affects the 
default UI, IIUC.