Convert modern indent specs to legacy for backward compatibility#3868
Open
Convert modern indent specs to legacy for backward compatibility#3868
Conversation
orchard's indent inference tables now emit modern tuple-format specs (e.g., [[:block 1] [:inner 0]]) which arrive via nREPL as the :style/indent metadata. Convert these to legacy format before passing to clojure-mode's clojure-get-indent-function hook, so older clojure-mode versions that don't understand the modern format still work correctly. New functions: - cider--modern-indent-spec-p: detect modern tuple format - cider--indent-spec-to-legacy: convert modern → legacy The conversion happens in cider--get-symbol-indent after reading and vector-to-list conversion.
Update indent_spec.adoc: - Present modern tuple format ([:block N], [:inner D], [:inner D I]) as the preferred format with a reference table - Reorganize examples to show modern format first - Add legacy format reference section with deprecation note Update indentation.adoc: - Use modern format in static and dynamic indentation examples - Add notes about legacy format backward compatibility
Add clear definitions for body-style indentation, special arguments, depth, and position — terms that were used throughout the docs but never explicitly defined. Expand the rule type descriptions with concrete explanations of what each depth level means. Explicitly call out cljfmt format compatibility with a link.
…uide Annotate all code examples with depth and position comments so readers can see exactly how rules map to indentation. Add a detailed explanation of why letfn needs [:inner 2 0] with a position restriction. Add a "Choosing the right rule" section with heuristics for when to use :block, :inner, and combinations. Replace the plain legacy format list with a side-by-side comparison table mapping modern to legacy specs for all complex built-in forms.
Rewrite the Special Arguments section to reference [:block N] rule and add depth annotations to examples. Rewrite the Internal Indentation section to explain [:inner 1] in terms of depth rather than legacy positional semantics. Add a new Namespace-Qualified Symbols section documenting clojure-mode's support for per-namespace indent overrides and the automatic fallback to unqualified specs.
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.
orchard's indent inference tables are being updated to emit modern tuple-format specs (
[[:block 1]],[[:inner 0]]) shared with clojure-mode and clojure-ts-mode (see clojure-emacs/orchard#381).This PR adds a conversion shim in
cider--get-symbol-indentthat converts modern-format specs to legacy format before passing them to clojure-mode'sclojure-get-indent-functionhook. This ensures compatibility with older clojure-mode versions that don't understand the modern format.New clojure-mode versions (with clojure-emacs/clojure-mode#702) handle both formats natively, so the conversion is redundant there but harmless. clojure-ts-mode has its own converter from legacy to modern, so it also works fine.
Companion PRs: