Skip to content

Conversation

@monnier
Copy link
Collaborator

@monnier monnier commented Nov 19, 2025

This commit aligns indentation var rules with those of Emacs-30

This introduces a new var editorconfig-indent-size-vars to determine how to set which variable for the current major mode. For modes which don't set this var, the default value still looks up editorconfig-indentation-alist but the documented format of that var is changed in two ways:

  • For (MODE . FUNCTION), FUNCTION should now return the settings as a list rather than apply the settings directly.
  • For (MODE . INDENT-SPEC-LIST), the elements in the list cannot be cons cells any more, only variable names.

The old format elements are still supported but a warning message is emitted when we encounter them.

In addition, if no entry is found in editorconfig-indentation-alist the default now tries to guess an appropriate variable name, by trying out a few common naming conventions.

monnier and others added 2 commits November 19, 2025 13:56
This commit aligns indentation var rules with those of Emacs-30

This introduces a new var `editorconfig-indent-size-vars` to determine
how to set which variable for the current major mode.
For modes which don't set this var, the default value
still looks up `editorconfig-indentation-alist` but the
documented format of that var is changed in two ways:

- For `(MODE . FUNCTION)`, FUNCTION should now return the settings
  as a list rather than apply the settings directly.
- For `(MODE . INDENT-SPEC-LIST)`, the elements in the list cannot
  be cons cells any more, only variable names.

The old format elements are still supported but a warning
message is emitted when we encounter them.

In addition, if no entry is found in `editorconfig-indentation-alist`
the default now tries to guess an appropriate variable name, by
trying out a few common naming conventions.

* editorconfig.el (editorconfig-indent-size-vars): New var.
(editorconfig--default-indent-size-function): New function.
(editorconfig--get-indentation): New function.
(editorconfig-set-indentation): Rewrite using it.
(editorconfig--get-indentation-web-mode)
(editorconfig--get-indentation-nxml-mode): New functions.
(editorconfig--get-indentation-(python|latex|lisp)-mode):
Rename from `editorconfig-set-indentation-*-mode` and make them return
a list of settings instead of setting the vars directly.
(editorconfig-indentation-alist): Remove entries for modes that follow
a common enough naming convention that
`editorconfig--default-indent-size-function` is able to guess the
relevant var's name.
Use the new `editorconfig--get-*` functions.
Adjust docstring to the new format.
@xuhdev xuhdev requested a review from 10sr November 27, 2025 02:17
Copy link
Member

@10sr 10sr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 👍 👍

@xuhdev xuhdev merged commit 946c09f into master Dec 6, 2025
11 checks passed
@xuhdev xuhdev deleted the indent-size-vars branch December 6, 2025 07:33
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.

4 participants