aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/env.el
diff options
context:
space:
mode:
authorRichard M. Stallman <[email protected]>1994-06-22 04:07:38 +0000
committerRichard M. Stallman <[email protected]>1994-06-22 04:07:38 +0000
commita3cda2735d45fb14dc296cc035ee531a1838b754 (patch)
treec84deb587ac1cf5fb0037e349c4e045f0ba00501 /lisp/env.el
parent0a1dd1c57ac09175dff0b38f15faef6540d6f83f (diff)
(setenv): Do something even if process-environment is nil.
Diffstat (limited to 'lisp/env.el')
-rw-r--r--lisp/env.el23
1 files changed, 13 insertions, 10 deletions
diff --git a/lisp/env.el b/lisp/env.el
index cc68de9cf0..cbf6dcf215 100644
--- a/lisp/env.el
+++ b/lisp/env.el
@@ -42,16 +42,19 @@ This function works by modifying `process-environment'."
(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)