Skip to content

Commit 8c1389c

Browse files
committed
Replace custom clojure-find-first with seq-find
seq-find is available since Emacs 25.1 and the package requires Emacs 27.1+, so there's no need for a custom implementation.
1 parent dcb96cf commit 8c1389c

1 file changed

Lines changed: 4 additions & 15 deletions

File tree

clojure-mode.el

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2384,17 +2384,6 @@ testing, give an easy way to turn this new behavior off."
23842384
:safe #'booleanp
23852385
:package-version '(clojure-mode . "5.9.0"))
23862386

2387-
(defun clojure-find-first (pred coll)
2388-
"Find first element of COLL for which PRED return truthy."
2389-
(let ((found)
2390-
(haystack coll))
2391-
(while (and (not found)
2392-
haystack)
2393-
(if (funcall pred (car haystack))
2394-
(setq found (car haystack))
2395-
(setq haystack (cdr haystack))))
2396-
found))
2397-
23982387
(defun clojure-beginning-of-defun-function (&optional n)
23992388
"Go to top level form.
24002389
Set as `beginning-of-defun-function' so that these generic
@@ -2413,10 +2402,10 @@ many times."
24132402
(beginning-of-defun-raw)
24142403
(forward-char 1) ;; skip paren so we start at comment
24152404
(clojure-forward-logical-sexp) ;; skip past the comment form itself
2416-
(if-let ((sexp-start (clojure-find-first (lambda (beg-pos)
2417-
(< beg-pos original-position))
2418-
(clojure-sexp-starts-until-position
2419-
clojure-comment-end))))
2405+
(if-let ((sexp-start (seq-find (lambda (beg-pos)
2406+
(< beg-pos original-position))
2407+
(clojure-sexp-starts-until-position
2408+
clojure-comment-end))))
24202409
(progn (goto-char sexp-start) t)
24212410
(beginning-of-defun-raw n))))
24222411
(scan-error (beginning-of-defun-raw n)))

0 commit comments

Comments
 (0)