Subject: Re: bug#10980: GNU bugs information: logs for bug#10980

From: Eli Zaretskii <[email-masked]>
Date: Tue, 21 Jun 2016 16:27:54 +0300

> From: Noam Postavsky <[email-masked]>
> Date: Mon, 20 Jun 2016 20:23:26 -0400
> Cc: [email-masked], [email-masked]
> 
> > I'm okay with considering patches specific to w32 that would eliminate
> > the need for pushing variables into the environment of subprocesses,
> > and/or leave initial-environment unaffected by the pushed values
> 
> How about splitting apart initialization of Vinitial_environment and
> Vprocess_environment and moving the former earlier so that it's
> unaffected by Emacs' manipulations of the environment? See attached
> patch.

Thanks.  However, I wonder if we could do better.  First, your patch
only fixed initial-environment, which means Lisp applications will
need to explicitly use it, and probably only on Windows, something
that is not the best solution, IMO.  I hoped we could come up with a
way of pushing the additional variables into Emacs's own environment
after Vprocess_environment is already computed -- can you try doing
that?

In any case, the reasons for calling the same function twice in two
different places should be explained, at least in the comments, or
else someone might become confused at some future point in time.
Better yet, perhaps only the Windows build should do something like
that, and the other platforms could continue using the current code
mostly unaltered, as they don't need this.

> > If you look in the $USERPROFILE directory on a typical Windows
> > machine, you won't see there any sub-directory or file created by an
> > application, only a few standard sub-directories.  Applications do
> > generally follow the above recommendations; for example, I have
> > Firefox installed, which keeps my customizations in
> > $APPDATA/Mozilla/Firefox/Profiles/.  So Git is the odd one out if it
> > puts its ~/.gitconfig file in $USERPROFILE.
> 
> To me it makes sense to have $HOME map to $USERPROFILE, and $APPDATA
> is like $XDG_CONFIG_HOME (usually ~/.config/ on GNU/Linux). However,
> this is purely subjective as there are no platform recommendations
> about translating environment variables to other platforms.

I quoted the platform recommendations that discourage putting files
directly under $USERPROFILE, and most programs, including those ported
from Posix platforms, do seem to follow those recommendations.