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

From: Spencer Baugh <[email-masked]>
Date: Tue, 15 Apr 2025 17:21:11 -0400

Stefan Monnier <[email-masked]> writes:
>> The completion table first tries to complete without
>> substituting environment variables; this allows completion to
>> work on file names which contain things which look like
>> environment variables.  If that fails, we call
>> substitute-in-file-name and then complete again.
>
> Why?  `substitute-in-file-name` presumably already takes care of that:
>
>     (substitute-in-file-name "/foo/$NOTAVAR/bar")
>     => "/foo/$NOTAVAR/bar"

To support completing file names that look like environment variables,
without the need to quote $ by duplicating it.

>> Tests are updated: we no longer duplicate $s in file names,
>> since that's not necessary.
>
> AFAIK it is still needed for the (null action) case.

Why would that be?  I believe quoting $ should no longer be necessary.

>> * lisp/minibuffer.el (completion--replace-prefix)
>> (completion--complete-on-expansion): Add.
>> (completion--file-name-table): Rewrite to use
>> substitute-in-file-name explicitly. (bug#77718)
>
> I think you can also delete `completion--sifn-requote` while at it.

Indeed, I will, just avoiding that for now while iterating on the patch.