diff options
author | Richard M. Stallman <rms@gnu.org> | 1994-06-22 04:07:38 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1994-06-22 04:07:38 +0000 |
commit | a3cda2735d45fb14dc296cc035ee531a1838b754 (patch) | |
tree | c84deb587ac1cf5fb0037e349c4e045f0ba00501 /lisp | |
parent | 0a1dd1c57ac09175dff0b38f15faef6540d6f83f (diff) | |
download | emacs-a3cda2735d45fb14dc296cc035ee531a1838b754.tar.gz |
(setenv): Do something even if process-environment is nil.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/env.el | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/lisp/env.el b/lisp/env.el index cc68de9cf00..cbf6dcf2156 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) |