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

From: Eli Zaretskii <[email-masked]>
Date: Thu, 17 Apr 2025 09:00:04 +0300

> From: Spencer Baugh <[email-masked]>
> Cc: [email-masked],  Eli Zaretskii <[email-masked]>,
>    [email-masked]
> Date: Wed, 16 Apr 2025 15:15:44 -0400
> 
> Stefan Monnier <[email-masked]> writes:
> 
> >>> [ Also, I'm not sure it's worth the trouble anyway: dollars in file names
> >>>   are fairly rare, so having to double them in those rare cases where they
> >>>   occur is not a big deal.  In any case, it seems orthogonal to the
> >>>   problem at hand.  ]
> >> That's fair - so you think it might be OK to, basically, not support
> >> completion on file names containing substrings like "$HOME"?
> >
> > Of course we support it, but we require the use of `$$HOME` to state
> > clearly which interpretation you want.
> 
> Ah, sure.  But my code supports completion on file names containing
> "$HOME" without the user of "$$HOME", which seems even nicer.

IMO, it's confusing, because it's inconsistent with the rest of
Emacs's behavior regarding file names with embedded "$".

> >> This TAB behavior doesn't help if I manually type $HOME though, right?
> >
> > Presumably if you type `$HOME` it means you want the value of the HOME
> > envvar.  If you want the file named `$HOME` you need to type `$$HOME`.
> >
> > When the typing is done by the completion code, it's up to the
> > completion code to apply that same rule.
> 
> Sure, that's fair.  Though, a user might not know that they can type
> $$HOME to get the file named '$HOME'; it's not that obvious.  It seems
> like it would be nice to automatically DTRT, where possible, without
> requiring them to know that.

What do you mean by "where possible"?  The behavior should be
consistent across all Emacs interfaces that accept file names, so
"where possible" should be common to all of them.  It would be wrong
for some UIs to use rules and exhibit behaviors that are different
from other UIs in this regard, since then the users will have much
harder time knowing what is right and what to expect.