summaryrefslogtreecommitdiff
path: root/lisp/env.el
diff options
context:
space:
mode:
authorGerd Moellmann <gerd@gnu.org>2000-05-15 14:50:12 +0000
committerGerd Moellmann <gerd@gnu.org>2000-05-15 14:50:12 +0000
commitb1e11b4f9f38559c1497e52f30bebc2fe28c530f (patch)
tree62336e9a4c3574d759cd5ce1b7ae718937021101 /lisp/env.el
parentb27f23c1db165a1d5ec365df596d8b4ce9cfeb84 (diff)
downloademacs-b1e11b4f9f38559c1497e52f30bebc2fe28c530f.tar.gz
(getenv): New function, interactively callable.
(setenv, getenv): Remove autoload cookies.
Diffstat (limited to 'lisp/env.el')
-rw-r--r--lisp/env.el14
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."
;; History list for VALUE argument to setenv.
(defvar setenv-history nil)
-;;;###autoload
(defun setenv (variable &optional value unset)
"Set the value of the environment variable named VARIABLE to VALUE.
VARIABLE should be a string. VALUE is optional; if not provided or is
@@ -91,6 +90,19 @@ This function works by modifying `process-environment'."
(cons (concat variable "=" value)
process-environment)))))))
+(defun getenv (variable)
+ "Get the value of environment variable VARIABLE.
+VARIABLE should be a string. Value is nil if VARIABLE is undefined in
+the environment. Otherwise, value is a string.
+
+This function consults the variable `process-environment'
+for its value."
+ (interactive (list (read-envvar-name "Get environment variable: " t)))
+ (let ((value (getenv-internal variable)))
+ (when (interactive-p)
+ (message "%s" (if value value "Not set")))
+ value))
+
(provide 'env)
;;; env.el ends here