From e362a6c99690cac6259c0a1726d32c4d2982a6c6 Mon Sep 17 00:00:00 2001 From: Bozhidar Batsov Date: Sun, 1 Nov 2026 12:46:07 +0200 Subject: [PATCH] Drop the indent specs cljfmt and clojure-ts-mode don't have async (from cljs.test), this-as and core.logic's run, run* and fresh were the only built-in indent specs that neither cljfmt nor clojure-ts-mode has, so the same code got indented differently depending on the tool. Without them they're indented like function calls, as the other two do it. Anyone who wants the old indentation can put it back with put-clojure-indent. --- CHANGELOG.md | 1 + clojure-mode.el | 7 ------- test/clojure-mode-indentation-test.el | 26 ++++---------------------- 3 files changed, 5 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9bb1d3e..628515ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ * [#709](https://github.com/clojure-emacs/clojure-mode/pull/709): Give `extend-protocol`, `extend-type`, `specify` and `specify!` the `((:block 1) (:inner 1))` indent spec that `clojure-ts-mode` and cljfmt use, instead of an `(:inner 0)` rule that only worked because of how it was converted to the legacy format (specs copied from it need `(:inner 1)` too). * [#709](https://github.com/clojure-emacs/clojure-mode/pull/709): Indent `fdef` like cljfmt does, as `((:inner 0))`, and list `let*` in the built-in indent specs, so that `clojure-get-indent-spec` returns its spec. * [#709](https://github.com/clojure-emacs/clojure-mode/pull/709): Add the indent specs that cljfmt and `clojure-ts-mode` have and `clojure-mode` lacked, which indents the bodies of `match` and `struct-map`, and the bindings of `with-open`, `with-redefs` and the like as special arguments. +* [#710](https://github.com/clojure-emacs/clojure-mode/pull/710): Drop the indent specs of `async`, `this-as` and core.logic's `run`, `run*` and `fresh`, which cljfmt and `clojure-ts-mode` don't have, so they're indented like function calls now (`put-clojure-indent` brings them back). ### Bugs fixed diff --git a/clojure-mode.el b/clojure-mode.el index 00ba442f..d3fce93f 100644 --- a/clojure-mode.el +++ b/clojure-mode.el @@ -2257,7 +2257,6 @@ work). To set it from Lisp code, use (if-let '((:block 1))) (when-some '((:block 1))) (if-some '((:block 1))) - (this-as '((:block 1))) ; ClojureScript (defmethod '((:inner 0))) @@ -2266,12 +2265,6 @@ work). To set it from Lisp code, use (deftest '((:inner 0))) (are '((:block 2))) (use-fixtures '((:inner 0))) - (async '((:block 1))) - - ;; core.logic - (run '((:inner 0))) - (run* '((:inner 0))) - (fresh '((:inner 0))) ;; core.match (match '((:block 1))) diff --git a/test/clojure-mode-indentation-test.el b/test/clojure-mode-indentation-test.el index feeeae38..1460883b 100644 --- a/test/clojure-mode-indentation-test.el +++ b/test/clojure-mode-indentation-test.el @@ -798,11 +798,6 @@ DESCRIPTION is a string with the description of the spec." my-fn :args (s/cat :x int?))") - (when-indenting-it "should handle this-as" - " -(this-as self - (.method self))") - ;; clojure.test (when-indenting-it "should handle testing" " @@ -825,28 +820,15 @@ DESCRIPTION is a string with the description of the spec." (use-fixtures :each my-fixture)") - (when-indenting-it "should handle async" + (when-indenting-it "should indent async and run* like function calls" " (async done - (do-stuff) - (done))") - - ;; core.logic - (when-indenting-it "should handle run" - " -(run [q] - (== q 1))") + (do-stuff) + (done))" - (when-indenting-it "should handle run*" " (run* [q] - (== q 1))") - - (when-indenting-it "should handle fresh" - " -(fresh [a b] - (== a 1) - (== b 2))") + (== q 1))") ;; core.async (when-indenting-it "should handle go"