Skip to content

Commit a07262b

Browse files
committed
Merge pull request #1080 from syohex/refactoring
Use string-match-p/looking-at-p as possible
2 parents 1c8fb7e + b7d0b16 commit a07262b

File tree

7 files changed

+14
-14
lines changed

7 files changed

+14
-14
lines changed

cider-client.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
;;; Evaluation helpers
9292
(defun cider-ns-form-p (form)
9393
"Check if FORM is an ns form."
94-
(string-match "^[[:space:]]*\(ns\\([[:space:]]*$\\|[[:space:]]+\\)" form))
94+
(string-match-p "^[[:space:]]*\(ns\\([[:space:]]*$\\|[[:space:]]+\\)" form))
9595

9696
(define-obsolete-function-alias 'cider-eval 'nrepl-request:eval)
9797

cider-debug.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ the following keys are available:
147147
(eval-buffer (current-buffer))
148148
(position (cider-defun-at-point-start-pos))
149149
(prefix
150-
(if (string-match "\\`(defn-? " expression)
150+
(if (string-match-p "\\`(defn-? " expression)
151151
"Instrumented => " "=> "))
152152
(instrumented (format cider--instrument-format
153153
(buffer-file-name)

cider-interaction.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1358,7 +1358,7 @@ until we find a delimiters that's not inside a string."
13581358
(if (and (looking-back "[])}]")
13591359
(null (nth 3 (syntax-ppss))))
13601360
(backward-sexp)
1361-
(while (or (not (looking-at "[({[]"))
1361+
(while (or (not (looking-at-p "[({[]"))
13621362
(nth 3 (syntax-ppss)))
13631363
(backward-char))))
13641364

cider-repl.el

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ the symbol."
513513
"Return t if the region from START to END is a complete sexp."
514514
(save-excursion
515515
(goto-char start)
516-
(cond ((looking-at "\\s *[@'`#]?[(\"]")
516+
(cond ((looking-at-p "\\s *[@'`#]?[(\"]")
517517
(ignore-errors
518518
(save-restriction
519519
(narrow-to-region start end)
@@ -571,7 +571,7 @@ If NEWLINE is true then add a newline at the end of the input."
571571
(goto-char (point-max))
572572
(cider-repl--mark-input-start)
573573
(cider-repl--mark-output-start)
574-
(if (and (not (string-match "\\`[ \t\r\n]*\\'" input))
574+
(if (and (not (string-match-p "\\`[ \t\r\n]*\\'" input))
575575
cider-repl-use-pretty-printing)
576576
(nrepl-request:pprint-eval
577577
input
@@ -763,7 +763,7 @@ Return -1 resp the length of the history if no item matches."
763763
(cl-loop for pos = (+ start-pos step) then (+ pos step)
764764
if (< pos 0) return -1
765765
if (<= len pos) return len
766-
if (string-match regexp (nth pos history)) return pos)))
766+
if (string-match-p regexp (nth pos history)) return pos)))
767767

768768
(defun cider-repl--history-replace (direction &optional regexp)
769769
"Replace the current input with the next line in DIRECTION.
@@ -846,7 +846,7 @@ If USE-CURRENT-INPUT is non-nil, use the current input."
846846
(use-current-input
847847
(assert (<= cider-repl-input-start-mark (point)))
848848
(let ((str (cider-repl--current-input t)))
849-
(cond ((string-match "^[ \n]*$" str) nil)
849+
(cond ((string-match-p "^[ \n]*$" str) nil)
850850
(t (concat "^" (regexp-quote str))))))
851851
(t nil)))
852852

cider-selector.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ DESCRIPTION is a one-line description of what the key selects.")
5050
Only considers buffers that are not already visible."
5151
(cl-loop for buffer in (buffer-list)
5252
when (and (with-current-buffer buffer (eq major-mode mode))
53-
(not (string-match "^ " (buffer-name buffer)))
53+
(not (string-match-p "^ " (buffer-name buffer)))
5454
(null (get-buffer-window buffer 'visible)))
5555
return buffer
5656
finally (error "Can't find unshown buffer in %S" mode)))

cider-test.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ This uses the Leiningen convention of appending '-test' to the namespace name."
401401
(when ns
402402
(let ((suffix "-test"))
403403
;; string-suffix-p is only available in Emacs 24.4+
404-
(if (string-match (rx-to-string `(: ,suffix eos) t) ns)
404+
(if (string-match-p (rx-to-string `(: ,suffix eos) t) ns)
405405
ns
406406
(concat ns suffix)))))
407407

nrepl-client.el

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ object is a root list or dict."
511511
((eobp)
512512
(cons :eob stack))
513513
;; truncation in the middle of an integer or in 123: string prefix
514-
((looking-at "[0-9i]")
514+
((looking-at-p "[0-9i]")
515515
(cons :stub stack))
516516
;; else, throw a quiet error
517517
(t
@@ -703,7 +703,7 @@ If NO-ERROR is non-nil, show messages instead of throwing an error."
703703
"Return a process filter that waits for PORT to appear in process output."
704704
(let ((port-string (format "LOCALHOST:%s" port)))
705705
(lambda (proc string)
706-
(when (string-match port-string string)
706+
(when (string-match-p port-string string)
707707
(process-put proc :waiting-for-port nil))
708708
(when (and (process-live-p proc)
709709
(buffer-live-p (process-buffer proc)))
@@ -1121,12 +1121,12 @@ Return a newly created process."
11211121
(when nrepl-buffer
11221122
(kill-buffer nrepl-buffer))
11231123
(cond
1124-
((string-match "^killed" event)
1124+
((string-match-p "^killed" event)
11251125
nil)
1126-
((string-match "^hangup" event)
1126+
((string-match-p "^hangup" event)
11271127
(when connection-buffer
11281128
(nrepl-close connection-buffer)))
1129-
((string-match "Wrong number of arguments to repl task" problem)
1129+
((string-match-p "Wrong number of arguments to repl task" problem)
11301130
(error "Leiningen 2.x is required by CIDER"))
11311131
(t (error "Could not start nREPL server: %s" problem)))))
11321132

0 commit comments

Comments
 (0)