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

From: Spencer Baugh <[email-masked]>
Date: Fri, 11 Apr 2025 15:43:18 -0400

Spencer Baugh <[email-masked]> writes:
> Reduced slightly, the issue is that
>   (completion-pcm--merge-completions '("x/" "y/") '(prefix))
> now returns 
>   ("/" any prefix "" "")
> when it used to return
>   (any "" "")
>
> I think this may be related to the implict "any" added by
> completion-pcm--merge-completions.  I'll look into it and find a fix
> (and add a test covering this case).

Update: That's not the issue; this new return value for
completion-pcm--merge-completions is actually correct, it's a desirable
consequence of my bugfix patch.

The issue is actually in completion-table-with-quoting, with filename
completion and substitute-in-file-name; it doesn't handle // properly.

I'm trying to fix it; it may be a somewhat large change to
completion-table-with-quoting.

Stefan, a related question: do you think it would be reasonable to split
completion-table-with-quoting into two functions, separating the
substitute-in-file-name and comint-quote-filename cases?  It seems to me
that the comint-quote-filename case is way simpler than the
substitute-in-file-name case, and it would be a lot easier to understand
if the two cases were done separately, without the abstraction of
requote and unquote functions.  I can do that if that seems reasonable.
It would make fixing this issue a lot easier.

(I don't think we need to maintain the same interface for
completion-table-with-quoting - I see no usage in the 200 packages used
at my site - I strongly suspect, given the complexity, that the only
users are in Emacs core)