diff lisp/env.el @ 83510:2d2f6f096f6e

Merged from emacs@sv.gnu.org Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-216 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-217 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-218 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-219 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-220 Improve tq.el. * emacs@sv.gnu.org/emacs--devo--0--patch-221 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-222 Update from CVS: src/puresize.h (PURESIZE_RATIO): Reduce to 10/6. * emacs@sv.gnu.org/emacs--devo--0--patch-223 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-224 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-225 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-226 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-227 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-228 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-229 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-230 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-231 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-232 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-233 Update from CVS: lisp/progmodes/python.el (python-mode): Fix typo. * emacs@sv.gnu.org/gnus--rel--5.10--patch-84 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-85 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-86 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-550
author Karoly Lorentey <lorentey@elte.hu>
date Wed, 19 Apr 2006 16:23:46 +0000
parents b98066f4aa10 d893c3bf4c3b
children 1321f6cfb389
line wrap: on
line diff
--- a/lisp/env.el	Wed Apr 12 17:40:36 2006 +0000
+++ b/lisp/env.el	Wed Apr 19 16:23:46 2006 +0000
@@ -94,15 +94,10 @@
 
 ;; Fixme: Should the environment be recoded if LC_CTYPE &c is set?
 
-(defun setenv (variable &optional value unset substitute-env-vars frame)
+(defun setenv (variable &optional value substitute-env-vars frame)
   "Set the value of the environment variable named VARIABLE to VALUE.
 VARIABLE should be a string.  VALUE is optional; if not provided or
 nil, the environment variable VARIABLE will be removed.
-UNSET if non-nil means to remove VARIABLE from the environment.
-SUBSTITUTE-ENV-VARS, if non-nil, means to substitute environment
-variables in VALUE with `substitute-env-vars', where see.
-Value is the new value if VARIABLE, or nil if removed from the
-environment.
 
 Interactively, a prefix argument means to unset the variable, and
 otherwise the current value (if any) of the variable appears at
@@ -116,6 +111,13 @@
 belonging to the selected frame, depending on the value of
 `local-environment-variables'.
 
+SUBSTITUTE-ENV-VARS, if non-nil, means to substitute environment
+variables in VALUE with `substitute-env-vars', which see.
+This is normally used only for interactive calls.
+
+The return value is the new value of VARIABLE, or nil if
+it was removed from the environment.
+
 If optional parameter FRAME is non-nil, then it should be a a
 frame.  If the specified frame has its own set of environment
 variables, this function will modify VARIABLE in it.  Note that
@@ -127,7 +129,7 @@
 a side-effect."
   (interactive
    (if current-prefix-arg
-       (list (read-envvar-name "Clear environment variable: " 'exact) nil t)
+       (list (read-envvar-name "Clear environment variable: " 'exact) nil)
      (let* ((var (read-envvar-name "Set environment variable: " nil))
 	    (value (getenv var)))
        (when value
@@ -137,7 +139,6 @@
 	     (read-from-minibuffer (format "Set %s to value: " var)
 				   nil nil nil 'setenv-history
 				   value)
-	     nil
 	     t))))
   (if (and (multibyte-string-p variable) locale-coding-system)
       (let ((codings (find-coding-systems-string (concat variable value))))
@@ -145,10 +146,9 @@
 		    (memq (coding-system-base locale-coding-system) codings))
 	  (error "Can't encode `%s=%s' with `locale-coding-system'"
 		 variable (or value "")))))
-  (if unset
-      (setq value nil)
-    (if substitute-env-vars
-	(setq value (substitute-env-vars value))))
+  (and value
+       substitute-env-vars
+       (setq value (substitute-env-vars value)))
   (if (multibyte-string-p variable)
       (setq variable (encode-coding-string variable locale-coding-system)))
   (if (and value (multibyte-string-p value))