89 |
|
|
90 |
(defun setenv (variable &optional value unset substitute-env-vars) |
(defun setenv (variable &optional value unset substitute-env-vars) |
91 |
"Set the value of the environment variable named VARIABLE to VALUE. |
"Set the value of the environment variable named VARIABLE to VALUE. |
92 |
VARIABLE should be a string. VALUE is optional; if not provided or is |
VARIABLE should be a string. VALUE is optional; if not provided or |
93 |
`nil', the environment variable VARIABLE will be removed. UNSET |
nil, the environment variable VARIABLE will be removed. UNSET |
94 |
if non-nil means to remove VARIABLE from the environment. |
if non-nil means to remove VARIABLE from the environment. |
95 |
SUBSTITUTE-ENV-VARS, if non-nil, means to substitute environment |
SUBSTITUTE-ENV-VARS, if non-nil, means to substitute environment |
96 |
variables in VALUE with `substitute-env-vars', where see. |
variables in VALUE with `substitute-env-vars', where see. |
126 |
(memq (coding-system-base locale-coding-system) codings)) |
(memq (coding-system-base locale-coding-system) codings)) |
127 |
(error "Can't encode `%s=%s' with `locale-coding-system'" |
(error "Can't encode `%s=%s' with `locale-coding-system'" |
128 |
variable (or value ""))))) |
variable (or value ""))))) |
129 |
(if unset |
(if unset |
130 |
(setq value nil) |
(setq value nil) |
131 |
(if substitute-env-vars |
(if substitute-env-vars |
132 |
(setq value (substitute-env-vars value)))) |
(setq value (substitute-env-vars value)))) |