Skip to content

Commit b9d65be

Browse files
committed
Update test; Add comments.
1 parent 51d6b48 commit b9d65be

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

clojure-mode.el

+4-1
Original file line numberDiff line numberDiff line change
@@ -1251,7 +1251,9 @@ Place point as in `clojure--position-for-alignment'."
12511251
found))
12521252

12531253
(defun clojure--search-whitespace-after-next-sexp (&optional bound _noerror)
1254-
"Move point after all whitespace after the next sexp.
1254+
"Move point after all whitespace after the next sexp. Also move
1255+
past a comment, if one exists (this is only possible when the end of
1256+
the sexp coincides with the end of a line).
12551257
12561258
Set the match data group 1 to be this region of whitespace and
12571259
return point.
@@ -1260,6 +1262,7 @@ BOUND is bounds the whitespace search."
12601262
(unwind-protect
12611263
(ignore-errors
12621264
(clojure-forward-logical-sexp 1)
1265+
;; Move past any whitespace or comment.
12631266
(search-forward-regexp "\\([,\s\t]*\\)\\(;+.*\\)?" bound)
12641267
(pcase (syntax-after (point))
12651268
;; End-of-line, try again on next line.

test/clojure-mode-indentation-test.el

+18-4
Original file line numberDiff line numberDiff line change
@@ -705,10 +705,24 @@ x
705705
"#?@(:clj [2]
706706
:cljs [2])")
707707

708-
(when-aligning-it "should work correctly when margin comments appear after multi-line, non-terminal sexps"
709-
"(let [:x (+ 2 3
710-
3 4) ; comment
711-
:y (+ 1 2)])")
708+
(when-aligning-it "should work correctly when margin comments appear after nested, multi-line, non-terminal sexps"
709+
"
710+
(let [x {:a 1
711+
:b 2} ; comment
712+
xx 3]
713+
x)"
714+
715+
"
716+
{:aa {:b 1
717+
:cc 2} ; comment
718+
:a 1}}"
719+
720+
"
721+
(case x
722+
:a (let [a 1
723+
aa (+ a 1)]
724+
aa); comment
725+
:aa 2)")
712726

713727
(it "should handle improperly indented content"
714728
(let ((content "(let [a-long-name 10\nb 20])")

0 commit comments

Comments
 (0)