Subject: Re: bug#40949: 26.3; substitute-env-in-file-name: Undefined variables not substituted

From: Marcus Harnisch <[email-masked]>
Date: Wed, 29 Apr 2020 14:06:11 +0200

On 29/04/2020 13.27, Eli Zaretskii wrote:
> Your report seems to imply that the behavior on MS-Windows is
> different, but it isn't: if the variable is undefined, we leave it
> unaltered on those systems as well.
The definition is special-cased for MS-Windows (passes result of getenv 
as opposed to a hardcoded t as optional argument to substitute-env-vars) 
and I am not able to check the relevant behaviour on that platform. 
That's why I pointed it out.
> Whether Emacs should follow what the shell does is a separate issue.
> In this case, since we use this function in substitute-in-file-name,
> what it does should serve what substitute-in-file-name was always
> doing: it left the $foo constructs unaltered.
It is probably moot to argue against long-standing practice, but the 
behaviour could perhaps benefit from a note in docstrings of functions 
that rely on `s-e-i-f-n'. Having used Emacsen and POSIX systems for 
about the same number of decades, I found this difference (Emacs vs 
shell) rather surprising.

Thanks,
Marcus