Subject: bug#73991: EditorConfig bundled with Emacs 30 does not set tab-width

From: Stefan Monnier <[email-masked]>
Date: Thu, 24 Oct 2024 15:56:51 -0400

> In Emacs 30.0.91, the debugger does not respond when watching the variable.

You can get the same behavior with

    indent_size = tab
    tab_width = 4

BTW, I think the patch below is in order: if the user sets
"indent_size=tab", which means that the "indentation step" should be
equal to `tab-width`, then we should default `indent-tabs-mode` to
t (which in EditorConfig parlance means to default `indent_style` to
`tab`).

Can I push this to `emacs-30` or do you, dear maintainers, prefer that
I push it to `master`?

        Stefan

diff --git a/lisp/editorconfig.el b/lisp/editorconfig.el
index c21e12559a6..478d94a2dc1 100644
--- a/lisp/editorconfig.el
+++ b/lisp/editorconfig.el
@@ -437,6 +437,11 @@ editorconfig--get-indentation
     (when tab_width
       (setq tab_width (string-to-number tab_width)))
 
+    ;; When users choose `indent_size=tab', they most likely prefer
+    ;; `indent_style=tab' as well.
+    (when (and (null style) (equal size "tab"))
+      (setq style "tab"))
+
     (setq size
           (cond ((editorconfig-string-integer-p size)
                  (string-to-number size))