Subject: Re: bug#25272: problem with imenu and company-mode

From: Dmitry Gutov <[email-masked]>
Date: Tue, 1 Dec 2020 02:50:43 +0200

On 30.11.2020 13:30, Lars Ingebrigtsen wrote:
> It's not really that clear what the issue is -- at least not to me.:-)
> Dmitry?

sh--cmd-completion-table (a completion table function) delegates to 
imenu--make-index-alist. Which is affected imenu-max-item-length: when 
an item gets too long, it is truncated.

That is fine for Imenu index, I guess, but creates invalid completions 
(the examples in the report are when function names are longer than 60 
chars).

A fix would be to either stop going through imenu--make-index-alist and 
write proper completion logic, or at least temporarily bind 
imenu-max-item-length to nil, while making sure to clear the imenu 
entries cache.