Avoid destroying match data in 'setenv' (Bug#32201)
authorJohn Shahid <jvshahid@gmail.com>
Thu, 19 Jul 2018 00:18:19 +0000 (20:18 -0400)
committerNoam Postavsky <npostavs@gmail.com>
Sun, 22 Jul 2018 01:10:20 +0000 (21:10 -0400)
* lisp/env.el (setenv,setenv-internal): Replace string-match with
string-match-p.

lisp/env.el

index e47eb57836f66b227ba349e772a6f0ccf5d9890f..7007ba33e58170723d63acc15764ea0f9d4da85b 100644 (file)
@@ -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))