aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/env.el
diff options
context:
space:
mode:
authorGerd Moellmann <[email protected]>2001-09-04 15:49:51 +0000
committerGerd Moellmann <[email protected]>2001-09-04 15:49:51 +0000
commit2a5becfb51236b09579de6cde203f47c489f2b0e (patch)
tree1b3e4b397c343b1fc74a3aa7fce7ad115206f2da /lisp/env.el
parent8d1fcd004ff6582e87b658da8e1d0d637e46fc0e (diff)
(setenv): Interactively, if VARIABLE has a current value,
add that to the front of the history, as the doc string says.
Diffstat (limited to 'lisp/env.el')
-rw-r--r--lisp/env.el9
1 files changed, 6 insertions, 3 deletions
diff --git a/lisp/env.el b/lisp/env.el
index 1824bd378c..58e830beaa 100644
--- a/lisp/env.el
+++ b/lisp/env.el
@@ -1,6 +1,6 @@
;;; env.el --- functions to manipulate environment variables
-;; Copyright (C) 1991, 1994 Free Software Foundation, Inc.
+;; Copyright (C) 1991, 1994, 2000, 2001 Free Software Foundation, Inc.
;; Maintainer: FSF
;; Keywords: processes, unix
@@ -62,11 +62,14 @@ This function works by modifying `process-environment'."
(interactive
(if current-prefix-arg
(list (read-envvar-name "Clear environment variable: " 'exact) nil t)
- (let ((var (read-envvar-name "Set environment variable: " nil)))
+ (let* ((var (read-envvar-name "Set environment variable: " nil))
+ (value (getenv var)))
+ (when value
+ (push value setenv-history))
;; Here finally we specify the args to give call setenv with.
(list var (read-from-minibuffer (format "Set %s to value: " var)
nil nil nil 'setenv-history
- (getenv var))))))
+ value)))))
(if unset (setq value nil))
(if (string-match "=" variable)
(error "Environment variable name `%s' contains `='" variable)