Skip to content

Commit fa3389a

Browse files
authored
[Fix #551] Indent clojure-align region before aligning (#552)
This prevents issues when aligning improperly indented code. Before, the region would be aligned while retaining the improper indentation. The follow-up indentation step would then break the alignment that was just performed. With this commit, we switch the order by indenting first then aligning. This retains compatibility with the test cases in #360.
1 parent 28024c5 commit fa3389a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

clojure-mode-indentation-test.el

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,13 @@ x
659659
"#?@(:clj [2]
660660
:cljs [2])")
661661

662+
(it "should handle improperly indented content"
663+
(let ((content "(let [a-long-name 10\nb 20])")
664+
(aligned-content "(let [a-long-name 10\n b 20])"))
665+
(with-clojure-buffer content
666+
(call-interactively #'clojure-align)
667+
(expect (buffer-string) :to-equal aligned-content))))
668+
662669
(it "should not align reader conditionals by default"
663670
(let ((content "#?(:clj 2\n :cljs 2)"))
664671
(with-clojure-buffer content

0 commit comments

Comments
 (0)