unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* setenv and let-binding process-environment
@ 2016-03-20  1:25 Michael Heerdegen
  2016-03-20 14:10 ` Wolfgang Jenkner
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Heerdegen @ 2016-03-20  1:25 UTC (permalink / raw)
  To: emacs-devel

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.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-03-20 14:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-20  1:25 setenv and let-binding process-environment Michael Heerdegen
2016-03-20 14:10 ` Wolfgang Jenkner
2016-03-20 14:39   ` Michael Heerdegen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).