summaryrefslogtreecommitdiff
path: root/lisp/env.el
diff options
context:
space:
mode:
authorJohn Shahid <jvshahid@gmail.com>2018-07-18 20:18:19 -0400
committerNoam Postavsky <npostavs@gmail.com>2018-07-21 21:10:20 -0400
commitb7ca3d5d932bad6900296679ab87f7d0d64d1de9 (patch)
tree996112444fdbb66260ec5dde10e4386ea9ef3a1b /lisp/env.el
parentf3f67cf0b9a6388d423e048a7aafad2eb531b5a5 (diff)
downloademacs-b7ca3d5d932bad6900296679ab87f7d0d64d1de9.tar.gz
Avoid destroying match data in 'setenv' (Bug#32201)
* lisp/env.el (setenv,setenv-internal): Replace string-match with string-match-p.
Diffstat (limited to 'lisp/env.el')
-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."
(not keep-empty)
env
(stringp (car env))
- (string-match pattern (car env)))
+ (string-match-p pattern (car env)))
(cdr env)
;; Try to find existing entry for VARIABLE in ENV.
(while (and scan (stringp (car scan)))
- (when (string-match pattern (car scan))
+ (when (string-match-p pattern (car scan))
(if value
(setcar scan (concat variable "=" value))
(if keep-empty
@@ -184,7 +184,7 @@ a side-effect."
(setq variable (encode-coding-string variable locale-coding-system)))
(if (and value (multibyte-string-p value))
(setq value (encode-coding-string value locale-coding-system)))
- (if (string-match "=" variable)
+ (if (string-match-p "=" variable)
(error "Environment variable name `%s' contains `='" variable))
(if (string-equal "TZ" variable)
(set-time-zone-rule value))