diff options
| author | Gerd Moellmann | 2000-05-15 14:50:12 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-05-15 14:50:12 +0000 |
| commit | b1e11b4f9f38559c1497e52f30bebc2fe28c530f (patch) | |
| tree | 62336e9a4c3574d759cd5ce1b7ae718937021101 /lisp | |
| parent | b27f23c1db165a1d5ec365df596d8b4ce9cfeb84 (diff) | |
| download | emacs-b1e11b4f9f38559c1497e52f30bebc2fe28c530f.tar.gz emacs-b1e11b4f9f38559c1497e52f30bebc2fe28c530f.zip | |
(getenv): New function, interactively callable.
(setenv, getenv): Remove autoload cookies.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/env.el | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lisp/env.el b/lisp/env.el index 02e4e04b625..4981fe68b4e 100644 --- a/lisp/env.el +++ b/lisp/env.el | |||
| @@ -49,7 +49,6 @@ If it is also not t, RET does not exit if it does non-null completion." | |||
| 49 | ;; History list for VALUE argument to setenv. | 49 | ;; History list for VALUE argument to setenv. |
| 50 | (defvar setenv-history nil) | 50 | (defvar setenv-history nil) |
| 51 | 51 | ||
| 52 | ;;;###autoload | ||
| 53 | (defun setenv (variable &optional value unset) | 52 | (defun setenv (variable &optional value unset) |
| 54 | "Set the value of the environment variable named VARIABLE to VALUE. | 53 | "Set the value of the environment variable named VARIABLE to VALUE. |
| 55 | VARIABLE should be a string. VALUE is optional; if not provided or is | 54 | VARIABLE should be a string. VALUE is optional; if not provided or is |
| @@ -91,6 +90,19 @@ This function works by modifying `process-environment'." | |||
| 91 | (cons (concat variable "=" value) | 90 | (cons (concat variable "=" value) |
| 92 | process-environment))))))) | 91 | process-environment))))))) |
| 93 | 92 | ||
| 93 | (defun getenv (variable) | ||
| 94 | "Get the value of environment variable VARIABLE. | ||
| 95 | VARIABLE should be a string. Value is nil if VARIABLE is undefined in | ||
| 96 | the environment. Otherwise, value is a string. | ||
| 97 | |||
| 98 | This function consults the variable `process-environment' | ||
| 99 | for its value." | ||
| 100 | (interactive (list (read-envvar-name "Get environment variable: " t))) | ||
| 101 | (let ((value (getenv-internal variable))) | ||
| 102 | (when (interactive-p) | ||
| 103 | (message "%s" (if value value "Not set"))) | ||
| 104 | value)) | ||
| 105 | |||
| 94 | (provide 'env) | 106 | (provide 'env) |
| 95 | 107 | ||
| 96 | ;;; env.el ends here | 108 | ;;; env.el ends here |