Subject: Re: bug#78944: 31.0.50; Minibuffer completion

From: Stefan Monnier <[email-masked]>
Date: Wed, 02 Jul 2025 16:15:50 -0400

>> Starting from 'emacs -Q', type this:
>>   M-x a u - f i - m o <TAB>
>> 
>> When I do it here, the minibuffer text completes to 'auto-fil-mode'
>> and the cursor goes just after the 'l'.
>> 
>> But, if I type '?' at that point, I see that 'auto-fill-mode' is the
>> only completion alternative available.  And '<TAB>' picks it as
>> expected.
>> 
>> So, why didn't the initial <TAB> pick the only possible completion alternative?

Because, between the two don't use the same completion style.

>From `au-fi-mo[]`, the `basic` completion style finds no match, so we
fallback on the `partial-completion` style which finds 2 matches
(`auto-fill-mode` and `auto-image-file-mode`).

>From `auto-fil[]-mode`, OTOH, the `basic` completion style does find
a match (`auto-fill-mode`), so we don't fallback on
`partial-completion`.

If you were looking for `auto-fill-mode`, this misfeature of the
`completion-styles` system is harmless (tho silly), but if you were
looking for `auto-image-file-mode` it can be a lot more annoying.
It's been with us since Emacs-24 so in practice it doesn't seem to be
too often problematic, but ... yeah ...

That's the best way I could find to satisfy the requirement from Richard
that prefix completion should work as before while at the same time
satisfying my requirement that `partial-completion` be enabled by default.

        Stefan