changeset 28917:845292e36d62

(getenv): New function, interactively callable. (setenv, getenv): Remove autoload cookies.
author Gerd Moellmann <gerd@gnu.org>
date Mon, 15 May 2000 14:50:12 +0000
parents 7be05bac1805
children e42cd428f056
files lisp/env.el
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/env.el	Mon May 15 14:50:00 2000 +0000
+++ b/lisp/env.el	Mon May 15 14:50:12 2000 +0000
@@ -49,7 +49,6 @@
 ;; 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 @@
 		    (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