Subject: bug#10980: 23.4; Variable initial-environment incorrectly set

From: "Bo Johansson" <[email-masked]>
Date: Fri, 23 Mar 2012 21:20:23 +0100

>From: Eli Zaretskii
>Date:     Fri, 23 Mar 2012 18:06:57 +0200
>> From: "Bo Johansson" <address@hidden>
>> Date: Fri, 23 Mar 2012 07:30:42 +0100
>>
>> On Windows the Emacs variable initial-environment is NOT set according to 
>> the
>> documentation:
>> "The variable initial-environment stores the initial environment 
>> inherited by
>> Emacs".
>
>I'm sorry, I'm not sure I understand the essence of your report.  What
>exactly would you like the documentation to say that it doesn't say
>now?  Or, to put it differently, what in the way initial-environment
>is set on Windows contradicts the documentation?
>
>Thanks.

Hej Eli!

My goal is:
I want to get the same result doing something from within Emacs as doing it 
from a Windows command prompt. To do "(compile "make" nil)" within Emacs 
should give the same result as doing "make" from the Windows command prompt.

The problem is:
The environment variables inherited by Emacs is changed. The changes in the 
environment leads to diffren results doing something from within Emacs 
compared to doing it from a Windows command prompt.

The BUG in Emacs is:
In Windows the variable initial-environment is set first after "the initial 
environment inherited by Emacs" is changed. The function init_environment 
(char ** argv) (in emacs-git/src/w32.c at line 1528)  changes the 
environment variables. The CHANGED "initial environment" is stored in the 
variable initial_environment by the function set_initial_environment (in 
emacs-git/src/callproc.c at line 1616).
However the documentation says: "The variable initial-environment stores the 
initial environment inherited by Emacs".

My goal can be achieved if the bug is corrected:
A correct value in the variable initial-environment is need to be able to 
know "the environment inherited by Emacs". This make it possible to use 
initial-environment in the lisp function (defun compilation-start (command 
&optional mode name-function highlight-regexp) in 
emacs-git/lisp/progmodes/simple.el:2088. The in emacs internal used 
environment variables can temporary be override by those in the variable 
initial-environment.
(It is of course also possible to use a new variable which contains "the 
initial environment inherited by Emacs".)

Summary: A value in the variable initial-environment according to the 
documentation makes it possible to "get the same result doing something from 
within Emacs as doing it from a Windows command prompt".

(See also 
http://lists.gnu.org/archive/html/bug-gnu-emacs/2012-03/msg00178.html.)

Best regards
Bosse