Subject: bug#77054: Completion highlighting applied outside completion-lazy-hilit-fn

From: Dmitry Gutov <[email-masked]>
Date: Thu, 20 Mar 2025 19:33:58 +0200

Hi!

On 16/03/2025 17:27, João Guerra wrote:
> TL;DR: Emacs applies additional completion highlighting even when
> completion-lazy-hilit-fn is set, leading to incorrect behaviour with
> alternative completion styles and frontends.
> 
> I'm implementing a custom fuzzy completion style and encountering an
> issue where Emacs highlights parts of completions that it shouldn't.

To clarify: this doesn't happen with any of the built-in styles, right?

That might mean that the new style violates some of the assumptions - 
perhaps ones that are not too well documented.

> When completing files and buffers, but not commands, Emacs is
> highlighting prefixes in
> [completion--twq-all](https://github.com/emacs-mirror/emacs/blob/8ac894e2246f25d2a2a97d866b10e6e0b0fede5a/lisp/minibuffer.el#L677).
> This becomes more evident if I make my completion-lazy-hilit-fn not do
> any highlighting: completions are still highlighted when they
> shouldn't at all.

To look at this another way - like Joao said, if this happens it might 
be a problem even without lazy highlighting. Does it occur then?

If so, might be unrelated to your style as well.