From: Stefan Monnier Date: Fri, 20 Sep 2024 18:58:45 +0000 (-0400) Subject: editorconfig.el: Fix too naive sync from upstream X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=26e65a093ef8a82fdfac338a80dd665353903c95;p=emacs.git 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. (cherry picked from commit db22efca8d4fa14118563ae24b292871c7fa350a) --- diff --git a/lisp/editorconfig.el b/lisp/editorconfig.el index 931781007d9..870f6d32162 100644 --- a/lisp/editorconfig.el +++ b/lisp/editorconfig.el @@ -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)