Subject: Re: bug#70105: 30.0.50; Emacs should support EditorConfig out of the box

From: Ihor Radchenko <[email-masked]>
Date: Tue, 18 Jun 2024 16:21:26 +0000

Stefan Monnier <[email-masked]> writes:

>> In particular, Org mode needs to use a fixed `tab-width' and
>> editorconfig must not override that (it is a part of the syntax).
>
> I don't understand: `tab-width` mostly affects the display, how can it
> break Org mode?

Because Org mode syntax depends on indentation for lists:

- parent list
  - sub-list
    - sub-sub-list

When the indentation has tabs in it, (current-indentation) return value
becomes a variable of `tab-width'. As a result, Org file syntax
unexpectedly becomes dependent on seemingly unrelated Emacs
configuration toggle.

(I also considered let-binding `tab-width' when Org parser the file, but
lists will then look funny visually)

> In any case, Org is not the only mode with such needs (Makefile, Haskell,
> Python, come to mind).  But also, disabling editorconfig wholesale seems
> a bit crude.  Maybe we'll need a more targeted way to address the problem
> (and there's always `hack-local-variables-hook`).

I did not imply that editorconfig should be _completely_ disabled.
Just for tab-width in our case.

I guess that `hack-local-variables-hook' should be an ok
option. Although it feels a bit funny to:
1. Set tab-width in org-mode body
2. Set it again in hack-local-variables-hook

>> We already had a user reporting problems caused by
>> https://github.com/editorconfig/editorconfig-emacs where tab-width was
>> changed to 4 by default.
>
> The upstream code sets `tab-width` in more cases than the code
> I'm submitting, so maybe I already fixed the problem?
> Do you have a more precise URL for the issue?

Hmm... Sorry, I cannot see anything in the list archives.
Either I made things up in my mind or it was discussed on IRC/Matrix.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>