Repository navigation
Fix the conversion of modern indent specs - #4226
Merged
Merged
Conversation
cider--indent-spec-to-legacy turns the modern :style/indent specs from cider-nrepl into the legacy format, which both clojure-mode and clojure-ts-mode accept. It got a few things wrong: - An :inner rule with a position went to that position in the list when there was no :block rule, but position 0 is the form itself, so [[:inner 1 0]] became ((:defn) nil). clojure-mode signaled an error indenting such a form, and clojure-ts-mode found no rules in it. - An (:inner 0) rule went at the end, where it applied to the arguments, so [[:block 1] [:inner 0]] indented them like [:inner 1] would. cljfmt ignores [:inner 0] next to a :block rule. - Several :inner rules without a position each took a position of their own, and only the last applied to the arguments after them. Reserve position 0 for the :block rule or (:inner 0), put the rules with a position after it, and end with the shallowest rule without one. clojure-mode's own copy of this conversion gets the same fix in clojure-emacs/clojure-mode#709.
bbatsov
force-pushed
the
fix-indent-spec-to-legacy
branch
from
November 1, 2026 09:35
3972460 to
09083f2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cider--indent-spec-to-legacyput an:innerrule with a position in the wrong place when there's no:blockrule, so:style/indent [[:inner 1 0]]broke indentation in both clojure-mode and clojure-ts-mode, and[:inner 0]next to a:blockrule applied to the arguments, unlike in cljfmt. clojure-mode's copy of the conversion gets the same fix in clojure-emacs/clojure-mode#709.