Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 ?

share|improve this question
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 '12 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 '12 at 11:23

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.

share|improve this answer

You must log in to answer this question.

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