bug#81591: 31.0.91; getenv fallback to selected frame is inaccurately documented

"Aaron Zeng" <[email protected]>
Newsgroups gmane.emacs.bugs
Message-ID <[email protected]>

On Mon, Aug 10, 2026, at 10:53, Eli Zaretskii wrote:
>> From: "Aaron L. Zeng" <[email protected]>
>> Date: Sun, 09 Aug 2026 15:19:15 -0400
>> 
>> Hello,
>> 
>> I noticed a discrepancy in the description of how `getenv' (with a nil
>> FRAME argument) behaves when a variable is not found in
>> process-environment but is found in the selected frame's environment
>> parameter.  getenv's docstring says:
>> 
>>     If optional parameter FRAME is non-nil, then it should be a
>>     frame.  This function will look up VARIABLE in its ‘environment’
>>     parameter.
>> 
>>     Otherwise, this function searches ‘process-environment’ for
>>     VARIABLE.  If it is not found there, then it continues the search
>>     in the environment list of the selected frame.
>> 
>> So, when FRAME is nil, I would expect that any variables not present
>> in `process-environment' should be looked up in the selected frame's
>> environment.  However, this does not happen for SSH_CONNECTION
>> (reading the source of getenv_internal, it seems to actually be a
>> special case for DISPLAY and no other variables).  I noticed I had to
>> explicitly pass the selected frame to the `getenv' function.
>> 
>> Looking at the history of getenv_internal, it seems quite deliberate
>> that DISPLAY is a special case and that no other variables were
>> intended to be looked up in the selected frame implicitly.  If that's
>> the case, I would suggest the docstring should be updated to mention
>> it.
>
> Thanks, should be fixed now.
>
> I took the opportunity to update the ELisp manual as well, which was
> also outdated and missing details in this regard.

Both changes look good to me also.  Thank you!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.