diff options
author | Richard M. Stallman <rms@gnu.org> | 1998-03-17 08:14:28 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1998-03-17 08:14:28 +0000 |
commit | 80370c1cecf15fa2e87c515434c593287e5ff604 (patch) | |
tree | 508b6a2b7ac184e594fa2f8cf460ef9914301108 /lisp/env.el | |
parent | 85cac557cd0457eb6029bda3c2e90736ef04b24e (diff) | |
download | emacs-80370c1cecf15fa2e87c515434c593287e5ff604.tar.gz |
(setenv): Simplify reading of args by passing old value as the default.
Diffstat (limited to 'lisp/env.el')
-rw-r--r-- | lisp/env.el | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/lisp/env.el b/lisp/env.el index c0e68f63412..02e4e04b625 100644 --- a/lisp/env.el +++ b/lisp/env.el @@ -63,29 +63,11 @@ 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)) - (oldval (getenv var)) - newval - oldhist) - ;; Don't put the current value on the history - ;; if it is already there. - (if (equal oldval (car setenv-history)) - (setq oldval nil)) - ;; Now if OLDVAL is non-nil, we should add it to the history. - (if oldval - (setq setenv-history (cons oldval setenv-history))) - (setq oldhist setenv-history) - (setq newval (read-from-minibuffer (format "Set %s to value: " var) - nil nil nil 'setenv-history)) - ;; If we added the current value to the history, remove it. - ;; Note that read-from-minibuffer may have added the new value. - ;; Don't remove that! - (if oldval - (if (eq oldhist setenv-history) - (setq setenv-history (cdr setenv-history)) - (setcdr setenv-history (cdr (cdr setenv-history))))) + (let ((var (read-envvar-name "Set environment variable: " nil))) ;; Here finally we specify the args to give call setenv with. - (list var newval)))) + (list var (read-from-minibuffer (format "Set %s to value: " var) + nil nil nil 'setenv-history + (getenv var)))))) (if unset (setq value nil)) (if (string-match "=" variable) (error "Environment variable name `%s' contains `='" variable) |