all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#72790: 30.0.90; editorconfig doesn't set tab_width to a default value
@ 2024-08-24 13:32 Damien Cassou
  0 siblings, 0 replies; only message in thread
From: Damien Cassou @ 2024-08-24 13:32 UTC (permalink / raw)
  To: 72790; +Cc: Jay Kamat, 10sr, Stefan Monnier

[-- Attachment #1: Type: text/plain, Size: 1707 bytes --]

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

[-- Attachment #2: .editorconfig --]
[-- Type: application/octet-stream, Size: 53 bytes --]

root = true

[*]
indent_style = tab
indent_size = 4


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: foo.js --]
[-- Type: text/javascript, Size: 25 bytes --]

function foo() {
	f();
}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-08-24 13:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-24 13:32 bug#72790: 30.0.90; editorconfig doesn't set tab_width to a default value Damien Cassou

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.