[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
setenv and let-binding process-environment
From: |
Michael Heerdegen |
Subject: |
setenv and let-binding process-environment |
Date: |
Sun, 20 Mar 2016 02:25:21 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.92 (gnu/linux) |
Hello,
I've fallen into a trap. I had expected that (something like)
(progn
(setenv "A" "1")
(let ((process-environment process-environment))
(setenv "A" "2"))
(getenv "A"))
would return "1", but it returns "2". A similar expression and the
false assumption about it's semantics introduced a weird issue in my
code.
But I think others could come to the same conclusion that I came to
after reading the docs (e.g. setenv doc: "This function works by
modifying ‘process-environment’").
Should we document that case, or change the behavior, or do I miss
something?
BTW, after having located the cause of the trouble, I changed the code
to use
(let ((process-environment (cons additional-binding process-environment)))
{ start the process })
following an advice in the manual. That works without problems.
Thanks,
Michael.
- setenv and let-binding process-environment,
Michael Heerdegen <=