changeset 8002:f8c8bbeca971

(setenv): Do something even if process-environment is nil.
author Richard M. Stallman <rms@gnu.org>
date Wed, 22 Jun 1994 04:07:38 +0000
parents 1a6bff2bc0e7
children 4c404df24ed1
files lisp/env.el
diffstat 1 files changed, 13 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/env.el	Tue Jun 21 20:49:12 1994 +0000
+++ b/lisp/env.el	Wed Jun 22 04:07:38 1994 +0000
@@ -42,16 +42,19 @@
     (let ((pattern (concat "\\`" (regexp-quote (concat variable "="))))
 	  (case-fold-search nil)
 	  (scan process-environment))
-      (while scan
-	(cond
-	 ((string-match pattern (car scan))
-          (if (eq nil value)
-              (setq process-environment (delq (car scan) process-environment))
-            (setcar scan (concat variable "=" value)))
-	  (setq scan nil))
-	 ((null (setq scan (cdr scan)))
-	  (setq process-environment
-		(cons (concat variable "=" value) process-environment))))))))
+      (if scan
+	  (while scan
+	    (cond
+	     ((string-match pattern (car scan))
+	      (if (eq nil value)
+		  (setq process-environment (delq (car scan) process-environment))
+		(setcar scan (concat variable "=" value)))
+	      (setq scan nil))
+	     ((null (setq scan (cdr scan)))
+	      (setq process-environment
+		    (cons (concat variable "=" value) process-environment)))))
+	(setq process-environment
+	      (cons (concat variable "=" value) process-environment))))))
 
 (provide 'env)