comparison lisp/env.el @ 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 253f761ad37b
children c1fb5574fc7a
comparison
equal deleted inserted replaced
39125:cd6477e9b6dc 39126:c0713ad66d33
1 ;;; env.el --- functions to manipulate environment variables 1 ;;; env.el --- functions to manipulate environment variables
2 2
3 ;; Copyright (C) 1991, 1994 Free Software Foundation, Inc. 3 ;; Copyright (C) 1991, 1994, 2000, 2001 Free Software Foundation, Inc.
4 4
5 ;; Maintainer: FSF 5 ;; Maintainer: FSF
6 ;; Keywords: processes, unix 6 ;; Keywords: processes, unix
7 7
8 ;; This file is part of GNU Emacs. 8 ;; This file is part of GNU Emacs.
60 60
61 This function works by modifying `process-environment'." 61 This function works by modifying `process-environment'."
62 (interactive 62 (interactive
63 (if current-prefix-arg 63 (if current-prefix-arg
64 (list (read-envvar-name "Clear environment variable: " 'exact) nil t) 64 (list (read-envvar-name "Clear environment variable: " 'exact) nil t)
65 (let ((var (read-envvar-name "Set environment variable: " nil))) 65 (let* ((var (read-envvar-name "Set environment variable: " nil))
66 (value (getenv var)))
67 (when value
68 (push value setenv-history))
66 ;; Here finally we specify the args to give call setenv with. 69 ;; Here finally we specify the args to give call setenv with.
67 (list var (read-from-minibuffer (format "Set %s to value: " var) 70 (list var (read-from-minibuffer (format "Set %s to value: " var)
68 nil nil nil 'setenv-history 71 nil nil nil 'setenv-history
69 (getenv var)))))) 72 value)))))
70 (if unset (setq value nil)) 73 (if unset (setq value nil))
71 (if (string-match "=" variable) 74 (if (string-match "=" variable)
72 (error "Environment variable name `%s' contains `='" variable) 75 (error "Environment variable name `%s' contains `='" variable)
73 (let ((pattern (concat "\\`" (regexp-quote (concat variable "=")))) 76 (let ((pattern (concat "\\`" (regexp-quote (concat variable "="))))
74 (case-fold-search nil) 77 (case-fold-search nil)