Skip to content

Commit 0946707

Browse files
committed
Convert whitespace alignment search from recursive to iterative
1 parent e0138ef commit 0946707

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

clojure-mode.el

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,16 +1503,20 @@ return point.
15031503
BOUND is bounds the whitespace search."
15041504
(unwind-protect
15051505
(ignore-errors
1506-
(clojure-forward-logical-sexp 1)
1507-
;; Move past any whitespace or comment.
1508-
(search-forward-regexp "\\([,\s\t]*\\)\\(;+.*\\)?" bound)
1509-
(pcase (syntax-after (point))
1510-
;; End-of-line, try again on next line.
1511-
(`(12) (clojure--search-whitespace-after-next-sexp bound))
1512-
;; Closing paren, stop here.
1513-
(`(5 . ,_) nil)
1514-
;; Anything else is something to align.
1515-
(_ (point))))
1506+
(let ((result 'continue))
1507+
(while (eq result 'continue)
1508+
(clojure-forward-logical-sexp 1)
1509+
;; Move past any whitespace or comment.
1510+
(search-forward-regexp "\\([,\s\t]*\\)\\(;+.*\\)?" bound)
1511+
(setq result
1512+
(pcase (syntax-after (point))
1513+
;; End-of-line, try again on next line.
1514+
(`(12) 'continue)
1515+
;; Closing paren, stop here.
1516+
(`(5 . ,_) nil)
1517+
;; Anything else is something to align.
1518+
(_ (point)))))
1519+
result))
15161520
(when (and bound (> (point) bound))
15171521
(goto-char bound))))
15181522

0 commit comments

Comments
 (0)