You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From: Eli Zaretskii Subject: bug#72808: 30.0.90; editorconfig doesn't set tab_width to a default value Date: Sat, 07 Sep 2024 10:27:44 +0300
> Cc: [email protected], [email protected], [email protected]
> From: Damien Cassou <[email protected]>
> Date: Sun, 25 Aug 2024 22:23:14 +0200
>
> Hi Stefan,
>
> Stefan Monnier <[email protected]> writes:
> >> 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,
> >
> > Yes, I consciously disagreed with the standard here. IMO, this better
> > reflects Emacs's habitual behavior, so it makes more sense for Emacs users.
> >
> > Indeed, you can already get the "missing" behavior by setting
> > `indent_size` to `tab` and then setting `tab_width` to the desired
> > indentation size.
>
> The problem is that the .editorconfig file can be shared across users of
> different editors for a given project. Emacs disagreeing with the
> standard means that Emacs users will now have to explain to their
> colleagues why they are introducing a change in a .editorconfig file
> that the standard says is unnecessary. This is putting me, at least, in
> an uncomfortable position with non-Emacs users in my team. Additionally,
> if other editors disagree with the standard for other reasons, we may
> quickly reach a situation where no content of .editorconfig will suit
> everyone.
Stefan, any further comments, or should we close this as wontfix?
bug#72808: 30.0.90; editorconfig doesn't set tab_width to a default valu
From: Stefan Monnier Subject: bug#72808: 30.0.90; editorconfig doesn't set tab_width to a default value Date: Sun, 08 Sep 2024 07:25:17 -0400 User-agent: Gnus/5.13 (Gnus v5.13)
>> The problem is that the .editorconfig file can be shared across users of
>> different editors for a given project. Emacs disagreeing with the
>> standard means that Emacs users will now have to explain to their
>> colleagues why they are introducing a change in a .editorconfig file
>> that the standard says is unnecessary. This is putting me, at least, in
>> an uncomfortable position with non-Emacs users in my team. Additionally,
>> if other editors disagree with the standard for other reasons, we may
>> quickly reach a situation where no content of .editorconfig will suit
>> everyone.
> Stefan, any further comments, or should we close this as wontfix?
I think Damien's argument makes a lot of sense.
I think mine makes sense as well.
I can't really judge which one will work out more often right, but as
the writer of the code I decided to try out my choice.
But I don't have a really strong opinion about it (I do have a strong
opinion that the EditorConfig standard's choice is wrong, but not
whether we should follow it or not): if you think Damien's preference is
better for Emacs, I'm fine to make the change.
Otherwise, I suggest we leave it like that for Emacs-30 and see how
things turn out.
Stefan
bug#72808: 30.0.90; editorconfig doesn't set tab_width to a default valu
From: Eli Zaretskii Subject: bug#72808: 30.0.90; editorconfig doesn't set tab_width to a default value Date: Sat, 21 Sep 2024 12:07:43 +0300
tags 72808 wontfix
close 72808
thanks
> From: Stefan Monnier <[email protected]>
> Cc: Damien Cassou <[email protected]>, [email protected],
> [email protected], [email protected]
> Date: Sun, 08 Sep 2024 07:25:17 -0400
>
> >> The problem is that the .editorconfig file can be shared across users of
> >> different editors for a given project. Emacs disagreeing with the
> >> standard means that Emacs users will now have to explain to their
> >> colleagues why they are introducing a change in a .editorconfig file
> >> that the standard says is unnecessary. This is putting me, at least, in
> >> an uncomfortable position with non-Emacs users in my team. Additionally,
> >> if other editors disagree with the standard for other reasons, we may
> >> quickly reach a situation where no content of .editorconfig will suit
> >> everyone.
> > Stefan, any further comments, or should we close this as wontfix?
>
> I think Damien's argument makes a lot of sense.
> I think mine makes sense as well.
> I can't really judge which one will work out more often right, but as
> the writer of the code I decided to try out my choice.
>
> But I don't have a really strong opinion about it (I do have a strong
> opinion that the EditorConfig standard's choice is wrong, but not
> whether we should follow it or not): if you think Damien's preference is
> better for Emacs, I'm fine to make the change.
>
> Otherwise, I suggest we leave it like that for Emacs-30 and see how
> things turn out.
I'm okay with closing this as wontfix. Let's see if we have more
complaints like this.
bug#73991: EditorConfig bundled with Emacs 30 does not set tab-width
From: Kenta USAMI Subject: bug#73991: EditorConfig bundled with Emacs 30 does not set tab-width Date: Fri, 25 Oct 2024 02:49:08 +0900
I use Emacs 30.0.91 and editorconfig-mode.
Emacs version is follows:
> This is GNU Emacs 30.0.91 (build 1, aarch64-apple-darwin23.6.0, NS
> appkit-2487.70 Version 14.7 (Build 23H124)) of 2024-10-22
I have an .editorconfig file like this:
# .editorconfig
root = true
[*.js]
indent_size = 4
indent_style = tab
# .editorconfig ends here
When I open a *.js file in the same directory, the tab-width variable is not set.
In the editorconfig of Emacs 28.2 and NonGNU-devel ELPA 2024-Jul-28 version installed on another machine, when I add (debug-on-variable-change 'tab-width), I get a stack trace like this:
Debugger entered--setting tab-width in buffer test.js to 4:
debug--implement-debug-watch(tab-width 4 set #<buffer test.js>)
editorconfig-set-indentation("tab" "4" "4")
editorconfig-set-local-variables(#<hash-table eql 3/65 0x15612d120fc3>)
editorconfig--advice-find-file-noselect(#<subr find-file-noselect> "/home/tadsan/poc-emacs30-editorconfig/test.js")
apply(editorconfig--advice-find-file-noselect #<subr find-file-noselect> "/home/tadsan/poc-emacs30-editorconfig/test.js")
find-file-noselect("/home/tadsan/poc-emacs30-editorconfig/test.js")
command-line-1(("-l" "init.el" "test.js"))
command-line()
normal-top-level()
Emacs version is follows:
> GNU Emacs 28.2 (build 2, x86_64-pc-linux-gnu) of 2023-05-14, modified by Debian
In Emacs 30.0.91, the debugger does not respond when watching the variable.
The files I used to check the operation are below:
https://github.com/zonuexe/poc-emacs30-editorconfig
Thank you in advance for your work on the Emacs 30 release.
Emacs 30.0.91とeditorconfig-modeを使っています。
Emacsのバージョンは以下の通り:
This is GNU Emacs 30.0.91 (build 1, aarch64-apple-darwin23.6.0, NS
appkit-2487.70 Version 14.7 (Build 23H124)) of 2024-10-22
bug#73991: EditorConfig bundled with Emacs 30 does not set tab-width
From: Eli Zaretskii
Subject: bug#73991: EditorConfig bundled with Emacs 30 does not set tab-width
Date: Thu, 24 Oct 2024 21:05:21 +0300
tags 73991 wontfix
thanks
> From: Kenta USAMI <[email protected]>
> Date: Fri, 25 Oct 2024 02:49:08 +0900
>
> I use Emacs 30.0.91 and editorconfig-mode.
>
> Emacs version is follows:
> > This is GNU Emacs 30.0.91 (build 1, aarch64-apple-darwin23.6.0, NS
> > appkit-2487.70 Version 14.7 (Build 23H124)) of 2024-10-22
>
> I have an .editorconfig file like this:
>
> # .editorconfig
> root = true
>
> [*.js]
> indent_size = 4
> indent_style = tab
> # .editorconfig ends here
>
> When I open a *.js file in the same directory, the tab-width variable is not
> set.
>
> In the editorconfig of Emacs 28.2 and NonGNU-devel ELPA 2024-Jul-28 version
> installed on another
> machine, when I add (debug-on-variable-change 'tab-width), I get a stack
> trace like this:
This is identical to bug#72808, which we decided we don't currently
want to fix, for the reasons explained there.
bug#73991: EditorConfig bundled with Emacs 30 does not set tab-width
From: Stefan Monnier Subject: bug#73991: EditorConfig bundled with Emacs 30 does not set tab-width Date: Thu, 24 Oct 2024 15:56:51 -0400 User-agent: Gnus/5.13 (Gnus v5.13)
> 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))
bug#73991: EditorConfig bundled with Emacs 30 does not set tab-width
From: Kenta USAMI Subject: bug#73991: EditorConfig bundled with Emacs 30 does not set tab-width Date: Fri, 25 Oct 2024 12:44:31 +0900
Hi Stefan,
> You can get the same behavior with
>
> indent_size = tab
> tab_width = 4
The settings mean the same thing, but I contribute to several projects on GitHub, so it wouldn't make sense to rewrite them all.
I accidentally replied to Eli about bug#72808 instead of to ML, so I'm resending it.
-----
I read bug #72808 and I don't quite understand what you and Stefan are saying.
> > Yes, I consciously disagreed with the standard here. IMO, this better
> > reflects Emacs's habitual behavior, so it makes more sense for Emacs users.
My feedback is as follows:
Without tab-width being honored, editing code in a project based on this setting would easily cause Emacs to break the indentation of that file.
I've been an editorconfig-mode user since 2014 and I don't think the behavior is reasonable.
If that were the default behavior I could correct it with advice, but forcing that on a large number of users would be terrible.
At the very least, I wish they would document it and make tab_width an opt-in option via a customization variable.
bug#73991: EditorConfig bundled with Emacs 30 does not set tab-width
From: Eli Zaretskii Subject: bug#73991: EditorConfig bundled with Emacs 30 does not set tab-width Date: Fri, 25 Oct 2024 10:37:57 +0300
> Cc: [email protected]
> From: Kenta USAMI <[email protected]>
> Date: Fri, 25 Oct 2024 12:44:31 +0900
>
> > You can get the same behavior with
> >
> > indent_size = tab
> > tab_width = 4
>
> The settings mean the same thing, but I contribute to several projects on
> GitHub, so it wouldn't make sense to
> rewrite them all.
Why not? Emacs is a major new player on this playground, so making
some minor changes for the benefit of using EditorConfig settings in
Emacs sounds justified to me.
Emacs uses tab-width in a special way, which is why we feel blindly
abiding by this setting in Emacs would be incorrect. If a way exists
to have both Emacs and the other editors happy, why not take it to
adapt?
bug#73991: EditorConfig bundled with Emacs 30 does not set tab-width
From: Kenta USAMI Subject: bug#73991: EditorConfig bundled with Emacs 30 does not set tab-width Date: Fri, 25 Oct 2024 12:44:31 +0900
Thank you for your suggestion.
However, the difference in these settings is as trivial as the color of a bike
shed to other editor implementations that comply with the EditorConfig specification.
I don't intend to send patches to numerous free software authors to fix something
that isn't broken. Frankly, it would feel like spam to people who don't use Emacs.
bug#73991: EditorConfig bundled with Emacs 30 does not set tab-width
*From: Eli Zaretskii Subject: bug#73991: EditorConfig bundled with Emacs 30 does not set tab-width Date: Fri, 25 Oct 2024 13:18:07 +0300
It would feel like spam only if you accept that POV. If you agree
with the POV I presented -- that the fact Emacs now supports
EditorConfig is worth some effort to adapt -- and try convincing
others to accept that, it won't look like spam, I'm sure.
bug#73991: EditorConfig bundled with Emacs 30 does not set tab-width
From: Kenta USAMI Subject: bug#73991: EditorConfig bundled with Emacs 30 does not set tab-width Date: Fri, 25 Oct 2024 19:49:06 +0900
The effort to change EditorConfig settings for each project is too small-scale
compared to other meaningful discussions, such as the need to guarantee
computing freedom. Forcing users who have used Emacs and EditorConfig and found
them useful to accept this inconvenient change when they update to Emacs 30
seems like nothing more than a negative campaign against Emacs, and an effort
to exclude casual Emacs users.
I have no other feedback on these efforts, but I am very grateful for your work.
Regards,
bug#73991: EditorConfig bundled with Emacs 30 does not set tab-width
From: Stefan Monnier Subject: bug#73991: EditorConfig bundled with Emacs 30 does not set tab-width Date: Fri, 25 Oct 2024 13:27:07 -0400 User-agent: Gnus/5.13 (Gnus v5.13)
> However, the difference in these settings is as trivial as the color
> of a bike shed to other editor implementations that comply with the
> EditorConfig specification.
Which begs the question: why have those three variables if many/most
of the combinations mean the same anyway.
Stefan
bug#73991: EditorConfig bundled with Emacs 30 does not set tab-width
From: Stefan Monnier Subject: bug#73991: EditorConfig bundled with Emacs 30 does not set tab-width Date: Fri, 25 Oct 2024 13:25:23 -0400 User-agent: Gnus/5.13 (Gnus v5.13)
>> You can get the same behavior with
>>
>> indent_size = tab
>> tab_width = 4
>
> The settings mean the same thing,
Do they? If so, why prefer the above formulation?
Also they don't seem to mean quite the same thing to me. The way I read
it, the above really says that an indent step should be a TAB since
that's what the first line says quite literally, whereas:
indent_size = 4
indent_style = tab
only says that an indentation step should span 4 columns, and that the
spacing inserted when indenting use TAB chars rather than spaces to move
from a the `N1 * tab_width` column to the `N2 * tab_width` column.
I think the two interpretations can only be mistaken as equivalent if
you ignore situations like
x.bar(arg1,
somefunctionwithalongname
(arg2))
where you can't align `somefunction` with TABs of width 4 (or 8 for that
matter), nor can you then properly indent `(arg2)` 4 columns further
with only TABs.
[ Admittedly, the spec of EditorConfig around `tab_width`,
`indent_size`, and `indent_style` is quite vague and hard to
interpret. OT1H it tends to conflate several notions of "TAB" and
"indentation steps" (like you're doing when you claim that both
settings mean the same), yet OTOH it goes through the trouble of
providing 3 different variables, thus recognizing that there is more
to it. ]
This said, I guess we could meet halfway and set `tab-width` to
`indent_size` when `indent_style = tab`, as in the patch below.
Stefan
diff --git a/lisp/editorconfig.el b/lisp/editorconfig.el
index c21e12559a6..83e4ea36731 100644
--- a/lisp/editorconfig.el
+++ b/lisp/editorconfig.el
@@ -434,8 +434,10 @@ editorconfig--get-indentation
(let ((style (gethash 'indent_style props))
(size (gethash 'indent_size props))
(tab_width (gethash 'tab_width props)))
- (when tab_width
- (setq tab_width (string-to-number tab_width)))
+ (cond
+ (tab_width (setq tab_width (string-to-number tab_width)))
+ ((and (equal style "tab") (editorconfig-string-integer-p size))
+ (setq tab_width (string-to-number size))))
(setq size
(cond ((editorconfig-string-integer-p size)