branch: elpa/git-commit commit 7671e46a8b7dfb0d9a438d9a07a656d7feea5c63 Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
Use string-search instead of string-match-p --- lisp/magit-clone.el | 4 ++-- lisp/magit-diff.el | 6 +++--- lisp/magit-git.el | 4 ++-- lisp/magit-log.el | 7 ++++--- lisp/magit-patch.el | 2 +- lisp/magit-remote.el | 2 +- lisp/magit-sequence.el | 2 +- 7 files changed, 14 insertions(+), 13 deletions(-) diff --git a/lisp/magit-clone.el b/lisp/magit-clone.el index 96889d9156..b332978957 100644 --- a/lisp/magit-clone.el +++ b/lisp/magit-clone.el @@ -317,9 +317,9 @@ Then show the status buffer for the new repository." (format-spec magit-clone-url-format `((?h . ,host) - (?n . ,(if (string-match-p "/" repo) + (?n . ,(if (string-search "/" repo) repo - (if (string-match-p "\\." user) + (if (string-search "." user) (if-let ((user (magit-get user))) (concat user "/" repo) (user-error "Set %S or specify owner explicitly" user)) diff --git a/lisp/magit-diff.el b/lisp/magit-diff.el index 76d3cc6175..a5619dc31d 100644 --- a/lisp/magit-diff.el +++ b/lisp/magit-diff.el @@ -1719,8 +1719,8 @@ the Magit-Status buffer for DIRECTORY." (offset 0)) (goto-char content) (while (< (point) target) - (unless (string-match-p - (if goto-from "\\+" "-") + (unless (string-search + (if goto-from "+" "-") (buffer-substring (point) (+ (point) prefix))) (cl-incf offset)) (forward-line)) @@ -2391,7 +2391,7 @@ section or a child thereof." 'font-lock-face 'magit-diff-file-heading) " (" (cond (rewind "rewind") - ((string-match-p "\\.\\.\\." range) "non-ff") + ((string-search "..." range) "non-ff") (t "new commits")) (and (or modified untracked) (concat ", " diff --git a/lisp/magit-git.el b/lisp/magit-git.el index b785691028..15d6ed445b 100644 --- a/lisp/magit-git.el +++ b/lisp/magit-git.el @@ -1303,7 +1303,7 @@ string \"true\", otherwise return nil." (defun magit-rev-head-p (rev) (or (equal rev "HEAD") (and rev - (not (string-match-p "\\.\\." rev)) + (not (string-search ".." rev)) (equal (magit-rev-parse rev) (magit-rev-parse "HEAD"))))) @@ -1904,7 +1904,7 @@ SORTBY is a key or list of keys to pass to the `--sort' flag of (let ((lines (magit-git-lines "for-each-ref" (concat "--format=" format) (or args (list "refs/heads" "refs/remotes" "refs/tags"))))) - (if (string-match-p "\f" format) + (if (string-search "\f" format) (--map (split-string it "\f") lines) lines))) diff --git a/lisp/magit-log.el b/lisp/magit-log.el index afd980b4d6..0ef03dcb23 100644 --- a/lisp/magit-log.el +++ b/lisp/magit-log.el @@ -1065,7 +1065,7 @@ Type \\[magit-reset] to reset `HEAD' to the commit at point. (count (and (= (length revs) 1) (> limit 1024) ; otherwise it's fast enough (setq revs (car revs)) - (not (string-match-p "\\.\\." revs)) + (not (string-search ".." revs)) (not (member revs '("--all" "--branches"))) (-none-p (lambda (arg) (--any-p (string-prefix-p it arg) @@ -1088,7 +1088,7 @@ Type \\[magit-reset] to reset `HEAD' to the commit at point. (defun magit-log-header-line-arguments (revs args files) "Return string describing some of the used arguments." (mapconcat (lambda (arg) - (if (string-match-p " " arg) + (if (string-search " " arg) (prin1 arg) arg)) `("git" "log" ,@args ,@revs "--" ,@files) @@ -1329,7 +1329,8 @@ Do not add this to a hook variable." (insert (format "%-2s " (1- magit-log-count))) (when refsub (insert (magit-reflog-format-subject - (substring refsub 0 (if (string-match-p ":" refsub) -2 -1)))))) + (substring refsub 0 + (if (string-search ":" refsub) -2 -1)))))) (when msg (insert (funcall magit-log-format-message-function hash msg))) (when (and refs magit-log-show-refname-after-summary) diff --git a/lisp/magit-patch.el b/lisp/magit-patch.el index 1d7bc100fc..a8ccc68861 100644 --- a/lisp/magit-patch.el +++ b/lisp/magit-patch.el @@ -106,7 +106,7 @@ which creates patches for all commits that are reachable from (concat (car (last revs)) "^.." (car revs)) (let ((range (magit-read-range-or-commit "Format range or commit"))) - (if (string-match-p "\\.\\." range) + (if (string-search ".." range) range (format "%s~..%s" range range)))) (let ((args (transient-args 'magit-patch-create))) diff --git a/lisp/magit-remote.el b/lisp/magit-remote.el index dae578612a..2665be7115 100644 --- a/lisp/magit-remote.el +++ b/lisp/magit-remote.el @@ -269,7 +269,7 @@ refspec." (let ((refspecs (magit-get-all "remote" remote "fetch")) (standard (format "+refs/heads/*:refs/remotes/%s/*" remote))) (when (and (= (length refspecs) 1) - (not (string-match-p "\\*" (car refspecs))) + (not (string-search "*" (car refspecs))) (yes-or-no-p (format "Also replace refspec %s with %s? " (car refspecs) standard))) diff --git a/lisp/magit-sequence.el b/lisp/magit-sequence.el index 7896d42f21..c5d9be2495 100644 --- a/lisp/magit-sequence.el +++ b/lisp/magit-sequence.el @@ -334,7 +334,7 @@ the process manually." (defun magit--cherry-pick (commits args &optional revert) (let ((command (if revert "revert" "cherry-pick"))) (when (stringp commits) - (setq commits (if (string-match-p "\\.\\." commits) + (setq commits (if (string-search ".." commits) (split-string commits "\\.\\.") (list commits)))) (magit-run-git-sequencer