GNU bug report logs - #73991
EditorConfig bundled with Emacs 30 does not set tab-width

Previous Next

Package: emacs;

Reported by: Kenta USAMI <zonuexe <at> zonu.me>

Date: Thu, 24 Oct 2024 17:51:01 UTC

Severity: wishlist

Tags: wontfix

Full log


View this message in rfc822 format

From: Kenta USAMI <zonuexe <at> zonu.me>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 73991 <at> debbugs.gnu.org
Subject: bug#73991: EditorConfig bundled with Emacs 30 does not set tab-width
Date: Fri, 25 Oct 2024 12:44:31 +0900
[Message part 1 (text/plain, inline)]
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.



2024年10月25日(金) 4:56 Stefan Monnier <monnier <at> iro.umontreal.ca>:

> > 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))
>
>
[Message part 2 (text/html, inline)]

This bug report was last modified 227 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.