Skip to content

Check the indentation of the sources on CI - #149

Merged
bbatsov merged 4 commits into
mainfrom
indent-check
Aug 22, 2026
Merged

Check the indentation of the sources on CI#149
bbatsov merged 4 commits into
mainfrom
indent-check

Conversation

@bbatsov

@bbatsov bbatsov commented Aug 22, 2026

Copy link
Copy Markdown
Member

Adds eldev indent, which reindents every Emacs Lisp source file and reports the lines that come out different (--fix rewrites them). make indent wraps it and the lint job runs that.

The fiddly part: a macro call's indentation comes from the declare form of the macro, so buttercup and the whole test suite have to be loaded before anything is checked, or describe, it and the test-helper macros fall back to default function indentation and every spec looks misindented. Blank lines and lone semicolon comments are exempt too, since Emacs aligns the latter to comment-column and a stray ; TODO would get "fixed" out to column 40.

The reindent commit is the fallout. The font-lock spec tables needed a small restructure rather than plain whitespace: their entries only lined up because someone aligned them by hand, and Emacs wants the continuation one column in from the open paren, which reads badly for a table of expectations. Moving the input to its own line keeps the layout and makes Emacs agree.

bbatsov added 4 commits July 15, 2026 12:31
Mirrors the config we use in CIDER.
Disable the line-length rule, which doesn't fit a changelog with
one-line entries.
Most of it was spec bodies sitting a couple of columns off from where
Emacs would put them, which is easy to do by hand and easy to copy into
the next spec.

The font-lock spec tables needed a bit more than whitespace: entries
like

    ("#_foo" ("#_" font-lock-comment-delimiter-face)
            ("foo" font-lock-comment-face))

only line up if you align them yourself, and Emacs wants to put the
continuation one column in from the open paren, which reads terribly for
a table of expectations. Moving the input to its own line gives the same
layout and Emacs agrees with it.

Claude-Session: https://claude.ai/code/session_01WFsEgHWFYxaACMvodJqz2z
Adds `eldev indent`, which reindents every Emacs Lisp source file and
reports the lines that come out different, plus `eldev indent --fix` to
rewrite them. `make indent` runs it and the lint job calls that.

The catch is that indentation of a macro call comes from the `declare`
form of the macro, so buttercup and the whole test suite have to be
loaded before anything is checked. Without them `describe', `it' and the
helpers in test-helper.el fall back to the default function indentation
and practically every spec looks misindented.

Blank lines and lone semicolon comments are left alone. Emacs aligns the
latter to `comment-column', which would push a stray `; TODO' out to
column 40 and is not worth policing.

Claude-Session: https://claude.ai/code/session_01WFsEgHWFYxaACMvodJqz2z
@bbatsov
bbatsov merged commit 5b4fad0 into main Aug 22, 2026
10 checks passed
@bbatsov
bbatsov deleted the indent-check branch August 26, 2026 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant