Subject: ehsell and process-environment variable

From: SK Kim <[email-masked]>
Date: Tue, 16 Jan 2018 11:31:27 +0900

I found weird situation and looked into it by myself but I couldn't
solve it. so I'm writing down this mail now.

I wanted to make a new term with modifed process-environment but it
did not work properly when I make a new term from eshell buffer.  The
situation can be reproduced as below.

1) start emacs with 'emacs -Q'

2) evaluate below code in any buffer.
    (let ((process-environment (cons "TEST=1234" process-environment)))
        (make-term "test-term" "/bin/bash"))

3) moved to buffer 'test-term' and type 'echo $TEST' and you can see
   the result '1234'

Above is what I expected modified process-environment variable would
work and it actually works as I expected. However there is a condition
it doesn't work as I expected.

1) start emacs with 'emacs -Q'

2) 'M-x eshell' to open eshell buffer.

3) evaluate below code in eshell buffer.
    (let ((process-environment (cons "TEST=1234" process-environment)))
        (make-term "test-term" "/bin/bash"))

4) moved to buffer 'test-term' and type 'echo $TEST' and you can see
   nothing.

The modified process-environment variable is not properly affected if
the code is evaluated in eshell buffer. The eshell buffer is the only
buffer that I found the above code is not working properly.

This is tested on GNU Emacs 25.3.1 (x86_64-pc-linux-gnu, X toolkit,
Xaw scroll bars) of 2017-12-13

Possibly this might not be a bug and there is specific reason it works
that way but I couldn't have found any information about this and
couldn't have solved this by myself neither. So now I am sending this
bug report.

Thanks for everyone contributing to emacs. I appreciate it.

Thanks.