branch: elpa/clojure-ts-mode commit 6db68e63c595d037ea497782e797cc5eae32cfcc Author: Roman Rudakov <rruda...@fastmail.com> Commit: Bozhidar Batsov <bozhi...@batsov.dev>
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. --- CHANGELOG.md | 2 ++ clojure-ts-mode.el | 3 ++- test/clojure-ts-mode-indentation-test.el | 10 +++++++++- test/samples/align.clj | 7 +++++++ 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 600eabd011..189cfb9c61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ - [#91](https://github.com/clojure-emacs/clojure-ts-mode/pull/91): Introduce `clojure-ts-cycle-keyword-string`. - [#92](https://github.com/clojure-emacs/clojure-ts-mode/pull/92): Add commands to convert between collections types. - [#93](https://github.com/clojure-emacs/clojure-ts-mode/pull/93): Introduce `clojure-ts-add-arity`. +- Fix an issue where `clojure-ts-align` would hang when called within an + expression containing ignored forms. ## 0.3.0 (2025-04-15) diff --git a/clojure-ts-mode.el b/clojure-ts-mode.el index 56fcd07bdc..cc10a65069 100644 --- a/clojure-ts-mode.el +++ b/clojure-ts-mode.el @@ -1505,7 +1505,8 @@ function literal." "var_quoting_lit" "sym_val_lit" "evaling_lit" "tagged_or_ctor_lit" "splicing_read_cond_lit" "derefing_lit" "quoting_lit" "syn_quoting_lit" - "unquote_splicing_lit" "unquoting_lit") + "unquote_splicing_lit" "unquoting_lit" + "dis_expr") "A regular expression that matches nodes that can be treated as s-expressions.") (defconst clojure-ts--list-nodes diff --git a/test/clojure-ts-mode-indentation-test.el b/test/clojure-ts-mode-indentation-test.el index 942175a209..2f6d4e3d8f 100644 --- a/test/clojure-ts-mode-indentation-test.el +++ b/test/clojure-ts-mode-indentation-test.el @@ -596,4 +596,12 @@ b |20])" :a (let [a 1 aa (+ a 1)] aa); comment - :aa 2)")) + :aa 2)") + + (when-aligning-it "should work correctly when there are ignored forms" + "{:map \"with\" + :some #_\"ignored\" \"form\"}" + + "{:map \"with\" + :multiple \"ignored\" + #_#_:forms \"foo\"}")) diff --git a/test/samples/align.clj b/test/samples/align.clj index f70e767103..b7933f3f42 100644 --- a/test/samples/align.clj +++ b/test/samples/align.clj @@ -55,3 +55,10 @@ aa (+ a 1)] aa); comment :aa 2) + +{:map "with" + :some #_"ignored" "form"} + +{:map "with" + :multiple "ignored" + #_#_:forms "foo"}