editorconfig.el: Fix too naive sync from upstream

* lisp/editorconfig.el (editorconfig--get-indentation-nxml-mode):
New function.
(editorconfig-indentation-alist): Use it to fix bug#73359.
This commit is contained in:
Stefan Monnier 2024-09-20 14:58:45 -04:00
parent 0f12d6dd23
commit db22efca8d

View file

@ -211,7 +211,7 @@ This hook will be run even when there are no matching sections in
(mustache-mode mustache-basic-offset)
(nasm-mode nasm-basic-offset)
(nginx-mode nginx-indent-level)
(nxml-mode nxml-child-indent (nxml-attribute-indent . 2))
(nxml-mode . editorconfig--get-indentation-nxml-mode)
(objc-mode c-basic-offset)
(octave-mode octave-block-offset)
(perl-mode perl-indent-level)
@ -266,7 +266,9 @@ This is a fallback used for those modes which don't set
`editorconfig-indent-size-vars'.
Each element should look like (MODE . SETTING) where SETTING
should obey the same rules as `editorconfig-indent-size-vars'."
should obey the same rules as `editorconfig-indent-size-vars',
i.e. either a list of variable names or a function returning a list of (VAR . VAL)
settings."
:type '(alist :key-type symbol
:value-type (choice function
(repeat
@ -341,6 +343,11 @@ Make a message by passing ARGS to `format-message'."
(LaTeX-indent-level . ,size)
(LaTeX-item-indent . ,(- size))))
(defun editorconfig--get-indentation-nxml-mode (size)
"Vars to set `nxml-mode' indent size to SIZE."
`((nxml-child-indent . ,size)
(nxml-attribute-indent . ,(* 2 size))))
(defun editorconfig--get-indentation-lisp-mode (size)
"Set indent size to SIZE for Lisp mode(s)."
(when (cond ((null editorconfig-lisp-use-default-indent) t)