9

When emacs starts it inherits the environment variables that are set at the time, either in the launching application (Linux) or in a central repository (the Windows registry).

On Windows, environment variables can be set globally. How could I prompt emacs to refresh its list of environment variables ?

I'm also interested on ways to refresh the variables on Linux (those changed in the shell that launched emacs), tough it seems much harder since there is no central repository of environment variables. Maybe by playing with emacsclient ?

2
  • Could you explain a little bit what Problem you're trying to solve? Why do you need to communicate through the Environment like this?
    – djf
    Aug 17, 2012 at 10:44
  • A simple case is installing a new command-line program. On Windows it might end up in "C:\Program Files\My Program\" for instance. To use this program on the command line, I need to add this path to the PATH environment variable. I use the emacs shell, and therefore I need to restart emacs (or add the variable to the environment manually in emacs) in order to make use of the new program.
    – Norswap
    Aug 17, 2012 at 11:23

1 Answer 1

2

Maybe you could create an external script which collects the names and values of environment variables then sends these name-value pairs to the running emacs via emacsclient, so emacs can set its own environment according to the received values with setenv.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .