APPROVE COMMIT
NOTE: This patch has been committed
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1518988732 0
#      Sun Feb 18 21:18:52 2018 +0000
# Node ID d6fdd3ac1276b343476887b4e12d0537c9370702
# Parent  92757c2b823956466492eb913941e96b2cd65c35
Use `string-match-p' more consistently, simple.el.
lisp/ChangeLog addition:
2018-02-18  Aidan Kehoe  <kehoea(a)parhasard.net>
	* simple.el (no-case-regexp-p):
	* simple.el (with-search-caps-disable-folding):
	* simple.el (with-interactive-search-caps-disable-folding):
	* simple.el (log-message-filter):
	Use `string-match-p' in these functions, no need to save the match
	data with same.
	* simple.el (clone-process):
	* simple.el (clone-buffer):
	* simple.el (clone-indirect-buffer):
	Ditto; use the same idiom throughout the file when stripping
	trailing <DIGIT+> patterns from strings.
diff -r 92757c2b8239 -r d6fdd3ac1276 lisp/ChangeLog
--- a/lisp/ChangeLog	Sat Dec 30 19:50:08 2017 +0900
+++ b/lisp/ChangeLog	Sun Feb 18 21:18:52 2018 +0000
@@ -1,3 +1,17 @@
+2018-02-18  Aidan Kehoe  <kehoea(a)parhasard.net>
+
+	* simple.el (no-case-regexp-p):
+	* simple.el (with-search-caps-disable-folding):
+	* simple.el (with-interactive-search-caps-disable-folding):
+	* simple.el (log-message-filter):
+	Use `string-match-p' in these functions, no need to save the match
+	data with same.
+	* simple.el (clone-process):
+	* simple.el (clone-buffer):
+	* simple.el (clone-indirect-buffer):
+	Ditto; use the same idiom throughout the file when stripping
+	trailing <DIGIT+> patterns from strings.
+
 2017-12-25  Aidan Kehoe  <kehoea(a)parhasard.net>
 
 	* hyper-apropos.el (hyper-apropos-grok-variables):
diff -r 92757c2b8239 -r d6fdd3ac1276 lisp/simple.el
--- a/lisp/simple.el	Sat Dec 30 19:50:08 2017 +0900
+++ b/lisp/simple.el	Sun Feb 18 21:18:52 2018 +0000
@@ -111,17 +111,16 @@
 
 This is intended to be used by interactive searching code to decide, in a
 do-what-I-mean fashion, whether a given search should be case-sensitive."
-  (let ((case-fold-search nil))
-    (save-match-data
-      (not (or (string-match "\\(^\\|\\\\\\\\\\|[^\\]\\)[[:upper:]]" regexp)
-               (and (string-match "\\[:\\(upp\\|low\\)er:]" regexp)
-                    (condition-case err
-                        (progn
-                          (string-match (substring regexp 0
-                                                   (match-beginning 0)) "")
-                          nil)
-                      (invalid-regexp
-                       (equal "Unmatched [ or [^" (cadr err))))))))))
+  (let ((case-fold-search nil) start)
+    (not (or (string-match-p "\\(^\\|\\\\\\\\\\|[^\\]\\)[[:upper:]]" regexp)
+             (and (setq start (string-match-p "\\[:\\(upp\\|low\\)er:]"
+                                              regexp))
+                  (condition-case err
+                      (progn
+                        (string-match-p (substring regexp 0 start) "")
+                        nil)
+                    (invalid-regexp
+                     (equal "Unmatched [ or [^" (cadr err)))))))))
 
 (defmacro* with-search-caps-disable-folding (string regexp-p &body body)
   "Execute the forms in BODY, respecting `search-caps-disable-folding'.
@@ -138,9 +137,8 @@
           (if (and case-fold-search search-caps-disable-folding)
               (if ,regexp-p
                   (no-case-regexp-p ,string)
-                (save-match-data
-                  (let (case-fold-search)
-                    (not (string-match "[[:upper:]]" ,string)))))
+                (let (case-fold-search)
+                  (not (string-match-p "[[:upper:]]" ,string))))
             case-fold-search)))
      ,@body))
 (put 'with-search-caps-disable-folding 'lisp-indent-function 2)
@@ -155,9 +153,8 @@
                    search-caps-disable-folding)
               (if ,regexp-p
                   (no-case-regexp-p ,string)
-                (save-match-data
-                  (let (case-fold-search)
-                    (not (string-match "[[:upper:]]" ,string)))))
+                (let (case-fold-search)
+                  (not (string-match-p "[[:upper:]]" ,string))))
             case-fold-search)))
      ,@body))
 (put 'with-interactive-search-caps-disable-folding 'lisp-indent-function 2)
@@ -3743,9 +3740,8 @@
 If PROCESS is associated with a buffer, the new process will be associated
   with the current buffer instead.
 Returns nil if PROCESS has already terminated."
-  (setq newname (or newname (process-name process)))
-  (if (string-match "<[0-9]+>\\'" newname)
-      (setq newname (substring newname 0 (match-beginning 0))))
+  (setq newname (or newname (process-name process))
+        newname (subseq newname 0 (string-match-p "<[0-9]+>\\'" newname)))
   (when (memq (process-status process) '(run stop open))
     (let* ((process-connection-type (process-tty-name process))
 	   (old-kwoq (process-kill-without-query process nil))
@@ -3784,9 +3780,8 @@
       (error "Cannot clone a file-visiting buffer"))
   (if (get major-mode 'no-clone)
       (error "Cannot clone a buffer in %s mode" mode-name))
-  (setq newname (or newname (buffer-name)))
-  (if (string-match "<[0-9]+>\\'" newname)
-      (setq newname (substring newname 0 (match-beginning 0))))
+  (setq newname (or newname (buffer-name))
+        newname (subseq newname 0 (string-match-p "<[0-9]+>\\'" newname)))
   (let ((buf (current-buffer))
 	(ptmin (point-min))
 	(ptmax (point-max))
@@ -3796,7 +3791,7 @@
 	(mode major-mode)
 	(lvars (buffer-local-variables))
 	(process (get-buffer-process (current-buffer)))
-	(new (generate-new-buffer (or newname (buffer-name)))))
+	(new (generate-new-buffer newname)))
     (save-restriction
       (widen)
       (with-current-buffer new
@@ -3846,9 +3841,8 @@
   (interactive (list (if current-prefix-arg
 			 (read-string "BName of indirect buffer: "))
 		     t))
-  (setq newname (or newname (buffer-name)))
-  (if (string-match "<[0-9]+>\\'" newname)
-      (setq newname (substring newname 0 (match-beginning 0))))
+  (setq newname (or newname (buffer-name))
+        newname (subseq newname 0 (string-match-p "<[0-9]+>\\'" newname)))
   (let* ((name (generate-new-buffer-name newname))
 	 (buffer (make-indirect-buffer (current-buffer) name t)))
     (when display-flag
@@ -4320,11 +4314,10 @@
 or whose label appears in `log-message-ignore-labels' are not saved."
   (let ((r  log-message-ignore-regexps)
 	(ok (not (memq label log-message-ignore-labels))))
-    (save-match-data
-      (while (and r ok)
-	(when (string-match (car r) message)
-	  (setq ok nil))
-	(setq r (cdr r))))
+    (while (and r ok)
+      (when (string-match-p (car r) message)
+        (setq ok nil))
+      (setq r (cdr r)))
     ok))
 
 (defun log-message-filter-errors-only (label message)
-- 
‘As I sat looking up at the Guinness ad, I could never figure out /
How your man stayed up on the surfboard after forty pints of stout’
(C. Moore)