aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2024-09-20 14:58:45 -0400
committerStefan Monnier2024-09-20 14:58:45 -0400
commitdb22efca8d4fa14118563ae24b292871c7fa350a (patch)
treec97191a6be5a283a09127c283e0a23b9602fef00
parent0f12d6dd23ce24dc880ec8981458fb369228262b (diff)
downloademacs-db22efca8d4fa14118563ae24b292871c7fa350a.tar.gz
emacs-db22efca8d4fa14118563ae24b292871c7fa350a.zip
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.
-rw-r--r--lisp/editorconfig.el11
1 files changed, 9 insertions, 2 deletions
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
211 (mustache-mode mustache-basic-offset) 211 (mustache-mode mustache-basic-offset)
212 (nasm-mode nasm-basic-offset) 212 (nasm-mode nasm-basic-offset)
213 (nginx-mode nginx-indent-level) 213 (nginx-mode nginx-indent-level)
214 (nxml-mode nxml-child-indent (nxml-attribute-indent . 2)) 214 (nxml-mode . editorconfig--get-indentation-nxml-mode)
215 (objc-mode c-basic-offset) 215 (objc-mode c-basic-offset)
216 (octave-mode octave-block-offset) 216 (octave-mode octave-block-offset)
217 (perl-mode perl-indent-level) 217 (perl-mode perl-indent-level)
@@ -266,7 +266,9 @@ This is a fallback used for those modes which don't set
266`editorconfig-indent-size-vars'. 266`editorconfig-indent-size-vars'.
267 267
268Each element should look like (MODE . SETTING) where SETTING 268Each element should look like (MODE . SETTING) where SETTING
269should obey the same rules as `editorconfig-indent-size-vars'." 269should obey the same rules as `editorconfig-indent-size-vars',
270i.e. either a list of variable names or a function returning a list of (VAR . VAL)
271settings."
270 :type '(alist :key-type symbol 272 :type '(alist :key-type symbol
271 :value-type (choice function 273 :value-type (choice function
272 (repeat 274 (repeat
@@ -341,6 +343,11 @@ Make a message by passing ARGS to `format-message'."
341 (LaTeX-indent-level . ,size) 343 (LaTeX-indent-level . ,size)
342 (LaTeX-item-indent . ,(- size)))) 344 (LaTeX-item-indent . ,(- size))))
343 345
346(defun editorconfig--get-indentation-nxml-mode (size)
347 "Vars to set `nxml-mode' indent size to SIZE."
348 `((nxml-child-indent . ,size)
349 (nxml-attribute-indent . ,(* 2 size))))
350
344(defun editorconfig--get-indentation-lisp-mode (size) 351(defun editorconfig--get-indentation-lisp-mode (size)
345 "Set indent size to SIZE for Lisp mode(s)." 352 "Set indent size to SIZE for Lisp mode(s)."
346 (when (cond ((null editorconfig-lisp-use-default-indent) t) 353 (when (cond ((null editorconfig-lisp-use-default-indent) t)