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

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

> 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 `/`, 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 "/").

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.

        Stefan