]> git.eshelyaron.com Git - emacs.git/commitdiff
Use string-search instead of string-match[-p] when possible
authorMattias Engdegård <mattiase@acm.org>
Sun, 26 Mar 2023 10:09:41 +0000 (12:09 +0200)
committerMattias Engdegård <mattiase@acm.org>
Sun, 26 Mar 2023 10:09:41 +0000 (12:09 +0200)
* lisp/progmodes/c-ts-mode.el
(c-ts-mode--standalone-parent-skip-preproc):
* lisp/progmodes/ruby-ts-mode.el (ruby-ts--align-chain):
* lisp/treesit.el (treesit-max-buffer-size)
(treesit--check-manual-coverage):
Use the much faster string-search when just searching for a substring.

lisp/progmodes/c-ts-mode.el
lisp/progmodes/ruby-ts-mode.el
lisp/treesit.el

index 59eb9fc23e6d5d7714bdf0b83603841d382177fa..d773b4a41f40036daba6cc94aec67bf4cd69086e 100644 (file)
@@ -322,7 +322,7 @@ PARENT is the same as other anchor functions."
       ;; nil.
       parent (lambda (node)
                (and node
-                    (not (string-match "preproc" (treesit-node-type node)))
+                    (not (string-search "preproc" (treesit-node-type node)))
                     (progn
                       (goto-char (treesit-node-start node))
                       (looking-back (rx bol (* whitespace))
index d077c43ba5295455438d4d276a2c64d0abcc4a6a..d1034d467ab9263f3e732fe3a9b4778277aa222b 100644 (file)
@@ -469,7 +469,7 @@ non-nil."
   (let* (first-call )
     (while (and parent
                 (setq first-call (treesit-node-parent parent))
-                (string-match-p "call" (treesit-node-type first-call)))
+                (string-search "call" (treesit-node-type first-call)))
       (setq parent first-call))
     (treesit-node-start (treesit-search-subtree parent "\\." nil t))))
 
index 367d2c66ac75b23f075f448b98f3410dd2b0bc39..2b0eca7f5c28368e7549eee8805a722f9a134a2c 100644 (file)
@@ -106,7 +106,7 @@ indent, imenu, etc."
     ;; 40MB for 64-bit systems, 15 for 32-bit.
     (if (or (< most-positive-fixnum (* 2.0 1024 mb))
             ;; 32-bit system with wide ints.
-            (string-match-p "--with-wide-int" system-configuration-options))
+            (string-search "--with-wide-int" system-configuration-options))
         (* 15 mb)
       (* 40 mb)))
   "Maximum buffer size (in bytes) for enabling tree-sitter parsing.
@@ -3090,7 +3090,7 @@ function signals an error."
          (with-temp-buffer
            (insert-file-contents (find-library-name "treesit"))
            (cl-remove-if
-            (lambda (name) (string-match "treesit--" name))
+            (lambda (name) (string-search "treesit--" name))
             (cl-sort
              (save-excursion
                (goto-char (point-min))