emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org e9110a8dd7 2/2: Prefer `string-search' when matchin


From: ELPA Syncer
Subject: [elpa] externals/org e9110a8dd7 2/2: Prefer `string-search' when matching exact strings
Date: Wed, 29 Mar 2023 09:58:55 -0400 (EDT)

branch: externals/org
commit e9110a8dd77c271248257f588c49796876500f22
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>

    Prefer `string-search' when matching exact strings
    
    * lisp/ob-core.el (org-babel-inline-result-wrap):
    (org-babel-demarcate-block):
    * lisp/org-agenda.el (org-agenda-get-represented-categories):
    * lisp/org-persist.el (org-persist--read-elisp-file):
    * lisp/ox-beamer.el (org-beamer--format-frame):
    * lisp/ox-latex.el (org-latex--environment-type):
    (org-latex--inline-image): Use a simple and faster `string-search'
    when searching for non-regexps.
---
 lisp/ob-core.el     | 4 ++--
 lisp/org-agenda.el  | 2 +-
 lisp/org-persist.el | 2 +-
 lisp/ox-beamer.el   | 4 ++--
 lisp/ox-latex.el    | 4 ++--
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 25074b3abd..471887a3a7 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -168,7 +168,7 @@ This string must include a \"%s\" which will be replaced by 
the results."
      'safe-local-variable
      (lambda (value)
        (and (stringp value)
-           (string-match-p "%s" value))))
+           (string-search "%s" value))))
 
 (defcustom org-babel-hash-show-time nil
   "Non-nil means show the time the code block was evaluated in the result 
hash."
@@ -1984,7 +1984,7 @@ block of the same language with the previous."
         (stars (concat (make-string (or (org-current-level) 1) ?*) " "))
         (upper-case-p (and block
                            (let (case-fold-search)
-                             (string-match-p "#\\+BEGIN_SRC" block)))))
+                             (string-search "#+BEGIN_SRC" block)))))
     (if (and info start) ;; At src block, but not within blank lines after it.
         (mapc
          (lambda (place)
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 892d88a774..e81a2c0fad 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -8597,7 +8597,7 @@ also press `-' or `+' to switch between filtering and 
excluding."
          (setq org-agenda-represented-categories
                ;; Enclose category names with a hyphen in double
                ;; quotes to process them specially in `org-agenda-filter'.
-               (mapcar (lambda (s) (if (string-match-p "-" s) (format "\"%s\"" 
s) s))
+               (mapcar (lambda (s) (if (string-search "-" s) (format "\"%s\"" 
s) s))
                        (nreverse (org-uniquify (delq nil categories)))))))))
 
 (defvar org-tag-groups-alist-for-agenda)
diff --git a/lisp/org-persist.el b/lisp/org-persist.el
index 4ef77e58bd..8e73fbc4bf 100644
--- a/lisp/org-persist.el
+++ b/lisp/org-persist.el
@@ -426,7 +426,7 @@ FORMAT and ARGS are passed to `message'."
          ;; Remove problematic file.
          (unless (bufferp buffer-or-file) (delete-file buffer-or-file))
          ;; Do not report the known error to user.
-         (if (string-match-p "Invalid read syntax" (error-message-string err))
+         (if (string-search "Invalid read syntax" (error-message-string err))
              (message "Emacs reader failed to read data in %S. The error was: 
%S"
                       buffer-or-file (error-message-string err))
            (warn "Emacs reader failed to read data in %S. The error was: %S"
diff --git a/lisp/ox-beamer.el b/lisp/ox-beamer.el
index 5df78d5a4f..59483e647f 100644
--- a/lisp/ox-beamer.el
+++ b/lisp/ox-beamer.el
@@ -452,12 +452,12 @@ used as a communication channel."
                    ;; allowed by Beamer.
                    (and (not (member "allowframebreaks" options))
                         (not (cl-some (lambda (s) (string-match-p "^label=" s))
-                                      options))
+                                    options))
                         (list
                          (let ((label (org-beamer--get-label headline info)))
                            ;; Labels containing colons need to be
                            ;; wrapped within braces.
-                           (format (if (string-match-p ":" label)
+                           (format (if (string-search ":" label)
                                        "label={%s}"
                                      "label=%s")
                                    label))))))
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 67d32984a3..cb152eb5ac 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -2638,7 +2638,7 @@ could be a member of `org-latex-caption-above' or `math'."
         (regexp-opt '("table" "longtable" "tabular" "tabu" "longtabu")))
        env)
       'table)
-     ((string-match-p "figure" env) 'image)
+     ((string-search "figure" env) 'image)
      ((string-match-p
        (eval-when-compile
         (regexp-opt '("lstlisting" "listing" "verbatim" "minted")))
@@ -2794,7 +2794,7 @@ used as a communication channel."
         (when (and search-option
                    (equal filetype "pdf")
                    (string-match-p "\\`[0-9]+\\'" search-option)
-                   (not (string-match-p "page=" options)))
+                   (not (string-search "page=" options)))
           (setq options (concat options ",page=" search-option))))
       (setq image-code
            (format "\\includegraphics%s{%s}"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]