Skip to content

Commit 6db68e6

Browse files
rrudakovbbatsov
authored andcommitted
Add dis_expr to the list of sexp things
This fixes a bug in clojure-ts-align. Before this change #_ and the following ignored expression were treated as 2 separate s-expressions, so we were stuck in an endless loop.
1 parent 9325374 commit 6db68e6

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
- [#91](https://github.com/clojure-emacs/clojure-ts-mode/pull/91): Introduce `clojure-ts-cycle-keyword-string`.
1818
- [#92](https://github.com/clojure-emacs/clojure-ts-mode/pull/92): Add commands to convert between collections types.
1919
- [#93](https://github.com/clojure-emacs/clojure-ts-mode/pull/93): Introduce `clojure-ts-add-arity`.
20+
- Fix an issue where `clojure-ts-align` would hang when called within an
21+
expression containing ignored forms.
2022

2123
## 0.3.0 (2025-04-15)
2224

clojure-ts-mode.el

+2-1
Original file line numberDiff line numberDiff line change
@@ -1505,7 +1505,8 @@ function literal."
15051505
"var_quoting_lit" "sym_val_lit" "evaling_lit"
15061506
"tagged_or_ctor_lit" "splicing_read_cond_lit"
15071507
"derefing_lit" "quoting_lit" "syn_quoting_lit"
1508-
"unquote_splicing_lit" "unquoting_lit")
1508+
"unquote_splicing_lit" "unquoting_lit"
1509+
"dis_expr")
15091510
"A regular expression that matches nodes that can be treated as s-expressions.")
15101511

15111512
(defconst clojure-ts--list-nodes

test/clojure-ts-mode-indentation-test.el

+9-1
Original file line numberDiff line numberDiff line change
@@ -596,4 +596,12 @@ b |20])"
596596
:a (let [a 1
597597
aa (+ a 1)]
598598
aa); comment
599-
:aa 2)"))
599+
:aa 2)")
600+
601+
(when-aligning-it "should work correctly when there are ignored forms"
602+
"{:map \"with\"
603+
:some #_\"ignored\" \"form\"}"
604+
605+
"{:map \"with\"
606+
:multiple \"ignored\"
607+
#_#_:forms \"foo\"}"))

test/samples/align.clj

+7
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,10 @@
5555
aa (+ a 1)]
5656
aa); comment
5757
:aa 2)
58+
59+
{:map "with"
60+
:some #_"ignored" "form"}
61+
62+
{:map "with"
63+
:multiple "ignored"
64+
#_#_:forms "foo"}

0 commit comments

Comments
 (0)