Skip to content

Commit 1d443e8

Browse files
author
Vadim Rodionov
committed
Fix infinite loop in clojure-sexp-starts-until-position
1 parent 906d6a4 commit 1d443e8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Diff for: clojure-mode.el

+5-2
Original file line numberDiff line numberDiff line change
@@ -2264,8 +2264,11 @@ position before the current position."
22642264
(while (< (point) position)
22652265
(clojure-forward-logical-sexp 1)
22662266
(clojure-backward-logical-sexp 1)
2267-
(push (point) sexp-positions)
2268-
(clojure-forward-logical-sexp 1))
2267+
;; Needed to prevent infinite recursion when there's only 1 form in buffer.
2268+
(if (eq (point) (car sexp-positions))
2269+
(goto-char position)
2270+
(push (point) sexp-positions)
2271+
(clojure-forward-logical-sexp 1)))
22692272
(scan-error nil))
22702273
sexp-positions)))
22712274

0 commit comments

Comments
 (0)