changeset 39126:c0713ad66d33

(setenv): Interactively, if VARIABLE has a current value, add that to the front of the history, as the doc string says.
author Gerd Moellmann <gerd@gnu.org>
date Tue, 04 Sep 2001 15:49:28 +0000
parents cd6477e9b6dc
children a1a9d15a79ba
files lisp/env.el
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/env.el	Tue Sep 04 13:21:08 2001 +0000
+++ b/lisp/env.el	Tue Sep 04 15:49:28 2001 +0000
@@ -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 @@
   (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)