aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Shahid2018-07-18 20:18:19 -0400
committerNoam Postavsky2018-07-21 21:10:20 -0400
commitb7ca3d5d932bad6900296679ab87f7d0d64d1de9 (patch)
tree996112444fdbb66260ec5dde10e4386ea9ef3a1b
parentf3f67cf0b9a6388d423e048a7aafad2eb531b5a5 (diff)
downloademacs-b7ca3d5d932bad6900296679ab87f7d0d64d1de9.tar.gz
emacs-b7ca3d5d932bad6900296679ab87f7d0d64d1de9.zip
Avoid destroying match data in 'setenv' (Bug#32201)
* lisp/env.el (setenv,setenv-internal): Replace string-match with string-match-p.
-rw-r--r--lisp/env.el6
1 files changed, 3 insertions, 3 deletions
diff --git a/lisp/env.el b/lisp/env.el
index e47eb57836f..7007ba33e58 100644
--- a/lisp/env.el
+++ b/lisp/env.el
@@ -113,11 +113,11 @@ Changes ENV by side-effect, and returns its new value."
113 (not keep-empty) 113 (not keep-empty)
114 env 114 env
115 (stringp (car env)) 115 (stringp (car env))
116 (string-match pattern (car env))) 116 (string-match-p pattern (car env)))
117 (cdr env) 117 (cdr env)
118 ;; Try to find existing entry for VARIABLE in ENV. 118 ;; Try to find existing entry for VARIABLE in ENV.
119 (while (and scan (stringp (car scan))) 119 (while (and scan (stringp (car scan)))
120 (when (string-match pattern (car scan)) 120 (when (string-match-p pattern (car scan))
121 (if value 121 (if value
122 (setcar scan (concat variable "=" value)) 122 (setcar scan (concat variable "=" value))
123 (if keep-empty 123 (if keep-empty
@@ -184,7 +184,7 @@ a side-effect."
184 (setq variable (encode-coding-string variable locale-coding-system))) 184 (setq variable (encode-coding-string variable locale-coding-system)))
185 (if (and value (multibyte-string-p value)) 185 (if (and value (multibyte-string-p value))
186 (setq value (encode-coding-string value locale-coding-system))) 186 (setq value (encode-coding-string value locale-coding-system)))
187 (if (string-match "=" variable) 187 (if (string-match-p "=" variable)
188 (error "Environment variable name `%s' contains `='" variable)) 188 (error "Environment variable name `%s' contains `='" variable))
189 (if (string-equal "TZ" variable) 189 (if (string-equal "TZ" variable)
190 (set-time-zone-rule value)) 190 (set-time-zone-rule value))