Subject: Re: bug#77718: 31.0.50; completion styles substring and flex are broken

From: Stephen Berman <[email-masked]>
Date: Wed, 18 Jun 2025 01:00:48 +0200

On Tue, 17 Jun 2025 15:55:25 -0400 Stefan Monnier <[email-masked]> wrote:

>> I'm not sure what you mean by "no other regression", but what I reported
>> upstream still holds in current master.  That is, start Emacs like this:
>>
>> emacs -Q --eval "(custom-set-variables '(completion-category-overrides
>> '((file (styles substring)))))"
>>
>> After typing `C-x d / TAB', I see this on master:
>>
>>    Dired (directory): ~///
>>
>> and after continuing typing `us TAB TAB', I see this:
>>
>>    Dired (directory): ~//usr//
>
> When I try your recipe I see something very similar, but my cursor is
> positioned right *before* the last `/`,

Yes, that's what I see, too; the screen shots failed to capture the
cursor and I failed to mention that.

>                                         so in terms of completion, it
> seems like an acceptable behavior (I'm not sure it's very useful, but
> it's the result of the generic attempt to insert the longest common
> substring, which happens to be just "/").

Yes, Spencer pointed this out too, and I can appreciate the desire to
strive for more consistency (whether this is an edge case or not), as
long as the resulting behavior is no worse than before; however...

> I do see one problem which is that the whole `~//usr/` prefix is greyed
> out by the rfn-shadow.
> It's not strictly incorrect since "/" is indeed the filename that would be
> returned if I were to hit RET to exit the minibuffer, but given that
> point is *before* it, we could argue that the `rfn-shadow` could/should
> presume that I'm about to type something in there, which will
> immediately bring the `/usr` back to life.

That, and also the points I mentioned in my reply to Spencer (extra TAB,
failure of `M-DEL').

Steve Berman