[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

AE.5 Environment Variables

The environment is a feature of the operating system; it consists of a collection of variables with names and values. Each variable is called an environment variable; environment variable names are case-sensitive, and it is conventional to use upper case letters only. The values are all text strings.

What makes the environment useful is that subprocesses inherit the environment automatically from their parent process. This means you can set up an environment variable in your login shell, and all the programs you run (including Emacs) will automatically see it. Subprocesses of Emacs (such as shells, compilers, and version-control software) inherit the environment from Emacs, too.

Inside Emacs, the command M-x getenv gets the value of an environment variable. M-x setenv sets a variable in the Emacs environment. The way to set environment variables outside of Emacs depends on the operating system, and especially the shell that you are using. For example, here's how to set the environment variable ORGANIZATION to `not very much' using Bash:

 
export ORGANIZATION="not very much"

and here's how to do it in csh or tcsh:

 
setenv ORGANIZATION "not very much"

When Emacs is uses the X Window System, it inherits the use of a large number of environment variables from the X libraries. See the X documentation for more information.

AE.5.1 General Variables  Environment variables that all versions of Emacs use.
AE.5.2 Miscellaneous Variables  Certain system-specific variables.



This document was generated on April 2, 2002 using texi2html