bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: setenv


From: Thomas F. Burdick
Subject: Re: setenv
Date: 02 Oct 2001 13:28:25 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.0.105

address@hidden (Miles Bader) writes:

> "Stefan Monnier" <monnier+gnu.emacs.bug/news/@RUM.cs.yale.edu> writes:
> > but changing the behavior of `setenv' would be 100% backward
> > compatible so there really doesn't seem to be any good reason not to
> > do it.
> 
> The point is to avoid people thinking that setenv is somehow special,
> and `better' than modifying process-environment, since it's often worse
> from a programming point of view.

In that case, I have a bug to report in the Elisp manual.  The node
"System environment" says:

 - Command: setenv VARIABLE VALUE
     This command sets the value of the environment variable named
     VARIABLE to VALUE.  Both arguments should be strings.  This
     function works by modifying `process-environment'; binding that
     variable with `let' is also reasonable practice.

 - Variable: process-environment
     This variable is a list of strings, each describing one environment
     variable.  The functions `getenv' and `setenv' work by means of
     this variable.

          process-environment
          => ("l=/usr/stanford/lib/gnuemacs/lisp"
              "PATH=.:/user/lewis/bin:/usr/class:/nfsusr/local/bin"
              "USER=lewis"

          "TERM=ibmapa16"
              "SHELL=/bin/csh"
              "HOME=/user/lewis")

One thing it doesn't specify is what happens if I do:

ELISP> process-environment
("_=/opt/local/gnu/bin/emacs21" "HOSTNAME=famine.OCF.Berkeley.EDU")

ELISP> (let ((process-environment (cons
                                    "HOSTNAME=mystery-machine.OCF.berkeley.EDU"
                                    process-environment)))
         ;; what's the value of HOSTNAME here?
         process-environment)
("HOSTNAME=mystery-machine.OCF.berkeley.EDU" "_=/opt/local/gnu/bin/emacs21" 
"HOSTNAME=famine.OCF.Berkeley.EDU")

The intuitive behavior is for process-environment to work like an
alist; this is confirmed by checking with `getenv'.  However, when the
behind-the-scenes syncing happens, does it do

  (mapc #'fix-in-C-env process-environment)

or

  (mapc #'fix-in-C-env (remove-duplicates process-environment ...))

That entries earlier in the list supersede the later entries should be
explicitly stated.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]