re-search-forward to search-forward when no re

When no regular expression is present, it's faster and simpler to use
search-forward

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
This commit is contained in:
Rudi Grinberg 2019-10-13 12:25:41 +09:00
parent 90b59d00df
commit 55e00bbd26
4 changed files with 4 additions and 4 deletions

View file

@ -107,7 +107,7 @@
(with-temp-buffer (with-temp-buffer
(insert-file-contents-literally core-file) (insert-file-contents-literally core-file)
(goto-char (point-min)) (goto-char (point-min))
(when (re-search-forward "doom-version" nil t) (when (search-forward "doom-version" nil t)
(forward-char) (forward-char)
(sexp-at-point)))))) (sexp-at-point))))))
"???") "???")

View file

@ -137,7 +137,7 @@ markdown and copies it to your clipboard, ready to be pasted into bug reports!"
(progn (progn
(save-excursion (save-excursion
(pp info (current-buffer))) (pp info (current-buffer)))
(when (re-search-forward "(modules " nil t) (when (search-forward "(modules " nil t)
(goto-char (match-beginning 0)) (goto-char (match-beginning 0))
(cl-destructuring-bind (beg . end) (cl-destructuring-bind (beg . end)
(bounds-of-thing-at-point 'sexp) (bounds-of-thing-at-point 'sexp)

View file

@ -424,7 +424,7 @@ If prefix arg is present, refresh the cache."
(progn (progn
(end-of-line) (end-of-line)
(insert "\n")) (insert "\n"))
(re-search-forward "\n\n" nil t)) (search-forward "\n\n" nil t))
(package--print-help-section "Package") (package--print-help-section "Package")
(insert (symbol-name package) "\n") (insert (symbol-name package) "\n")

View file

@ -139,7 +139,7 @@ was installed with."
(when (file-readable-p file) (when (file-readable-p file)
(insert-file-contents file) (insert-file-contents file)
(delay-mode-hooks (emacs-lisp-mode)) (delay-mode-hooks (emacs-lisp-mode))
(while (re-search-forward "(package! " nil t) (while (search-forward "(package! " nil t)
(save-excursion (save-excursion
(goto-char (match-beginning 0)) (goto-char (match-beginning 0))
(unless (let ((ppss (syntax-ppss))) (unless (let ((ppss (syntax-ppss)))