Subject: 30.0.90; editorconfig doesn't set tab_width to a default value

From: Damien Cassou <[email-masked]>
Date: Sat, 24 Aug 2024 15:32:52 +0200

Hi,

when a .editorconfig file assigns a value for "indent_size" and no
value for "tab_width", I expect "tab_width" to default to the value of
"indent_size" as described in the documentation [1]. Unfortunately,
the Emacs variable `tab-width` isn't set by the builtin version of
`editorconfig-mode` in this case.

Possible workarounds:

1. One can use MELPA's version of editorconfig instead of the builtin
   one; or
2. One can explicitly set "tab_width" in .editorconfig

How to reproduce:

1. Create a directory "~/tmp/emacs-test-indent-size"
2. Put the 2 attached files (".editorconfig" and "foo.js") inside
3. Run the code below

$ emacs --batch -Q \
  --eval "(require 'editorconfig)" \
  --eval "(find-file \"~/tmp/emacs-test-indent-size/foo.js\")" \
  --eval "(editorconfig-apply)" \
  --eval "(message \"%S\" (map-keys editorconfig-properties-hash)))"

Actual: (indent_style indent_size)
Expected: (indent_style indent_size tab_width)

4. Download editorconfig version 20240813.801 from [2]
5. Rerun the command above but with the following as first --eval argument:

   --eval "(add-to-list 'load-path \"/path/to/editorconfig-20240813.801\")" 

You get the expected result.

  [1] https://editorconfig.org/
  [2] https://melpa.org/#/editorconfig

In GNU Emacs 30.0.90 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo
version 1.18.0, Xaw3d scroll bars)
Repository revision: 391e6f99fc8eed9cf2ede473b84be194aaab21c7
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12014000
System Description: Fedora Linux 40 (Workstation Edition)

-- 
Damien Cassou

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill