Changeset 4071 for vendor/emacs-CVS_HEAD/lisp/env.el
- Timestamp:
- 05/03/06 18:06:44 (3 years ago)
- Files:
-
- vendor/emacs-CVS_HEAD/lisp/env.el (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
vendor/emacs-CVS_HEAD/lisp/env.el
r4035 r4071 91 91 ;; Fixme: Should `process-environment' be recoded if LC_CTYPE &c is set? 92 92 93 (defun setenv (variable &optional value unsetsubstitute-env-vars)93 (defun setenv (variable &optional value substitute-env-vars) 94 94 "Set the value of the environment variable named VARIABLE to VALUE. 95 95 VARIABLE should be a string. VALUE is optional; if not provided or 96 nil, the environment variable VARIABLE will be removed. UNSET 97 if non-nil means to remove VARIABLE from the environment. 98 SUBSTITUTE-ENV-VARS, if non-nil, means to substitute environment 99 variables in VALUE with `substitute-env-vars', where see. 100 Value is the new value if VARIABLE, or nil if removed from the 101 environment. 96 nil, the environment variable VARIABLE will be removed. 102 97 103 98 Interactively, a prefix argument means to unset the variable. … … 105 100 appears at the front of the history list when you type in the new value. 106 101 Interactively, always replace environment variables in the new value. 102 103 SUBSTITUTE-ENV-VARS, if non-nil, means to substitute environment 104 variables in VALUE with `substitute-env-vars', which see. 105 This is normally used only for interactive calls. 106 107 The return value is the new value of VARIABLE, or nil if 108 it was removed from the environment. 107 109 108 110 This function works by modifying `process-environment'. … … 112 114 (interactive 113 115 (if current-prefix-arg 114 (list (read-envvar-name "Clear environment variable: " 'exact) nil t)116 (list (read-envvar-name "Clear environment variable: " 'exact) nil) 115 117 (let* ((var (read-envvar-name "Set environment variable: " nil)) 116 118 (value (getenv var))) … … 122 124 nil nil nil 'setenv-history 123 125 value) 124 nil125 126 t)))) 126 127 (if (and (multibyte-string-p variable) locale-coding-system) … … 130 131 (error "Can't encode `%s=%s' with `locale-coding-system'" 131 132 variable (or value ""))))) 132 (if unset 133 (setq value nil) 134 (if substitute-env-vars 135 (setq value (substitute-env-vars value)))) 133 (and value 134 substitute-env-vars 135 (setq value (substitute-env-vars value))) 136 136 (if (multibyte-string-p variable) 137 137 (setq variable (encode-coding-string variable locale-coding-system)))
