From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Kenta USAMI Newsgroups: gmane.emacs.bugs Subject: bug#73991: EditorConfig bundled with Emacs 30 does not set tab-width Date: Fri, 25 Oct 2024 12:44:31 +0900 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000070b96d062544f06c" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40644"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 73991@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Oct 25 05:47:03 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1t4BHy-000ANa-TO for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 25 Oct 2024 05:47:03 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t4BHf-0006Dq-8O; Thu, 24 Oct 2024 23:46:43 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t4BHU-0006D9-23 for bug-gnu-emacs@gnu.org; Thu, 24 Oct 2024 23:46:34 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t4BHT-0003iW-Oj for bug-gnu-emacs@gnu.org; Thu, 24 Oct 2024 23:46:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=Date:From:In-Reply-To:References:MIME-Version:To:Subject; bh=nMeiEzOX5oZNYUkNmL6AvYe5x/trCgUY5BDQIk2tnHg=; b=G/0BnBbjqibQEhNnTWoVKR75GvLy/r+sdYEO0YKJKkbVKtlu3rEKFTSVpoBXtNHXcTZcHACqqwwl/QJLkM0YLl91PysJhfNN5zzxcl9BJVlN3W6t5XbknFbgxbJfARphBZ0RMkkofRW0Lf3CKQm4SAg10VSg3skKB3ZoCX7CjDpvm76c4L2RMIG9oMHIqwDVPffkq0XwV9UP1se4ro+/SjoAe88Z0Emz1rcr7iyFvYSNng1iiU4uwy0k27ri4Nos8J7X0hZWdpLSFAit7YQcUkR7lkma3osbeHSl7gugDZE/PhAywBl/71dm8drmZqvsUxQJ/JdIj9YzhR8bgf16RA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t4BHy-00029S-5I for bug-gnu-emacs@gnu.org; Thu, 24 Oct 2024 23:47:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Kenta USAMI Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 25 Oct 2024 03:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73991 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: wontfix Original-Received: via spool by 73991-submit@debbugs.gnu.org id=B73991.17298279838200 (code B ref 73991); Fri, 25 Oct 2024 03:47:02 +0000 Original-Received: (at 73991) by debbugs.gnu.org; 25 Oct 2024 03:46:23 +0000 Original-Received: from localhost ([127.0.0.1]:36783 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t4BHL-00028C-6Q for submit@debbugs.gnu.org; Thu, 24 Oct 2024 23:46:23 -0400 Original-Received: from mail-pf1-f177.google.com ([209.85.210.177]:45141) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t4BHH-00027v-Qn for 73991@debbugs.gnu.org; Thu, 24 Oct 2024 23:46:20 -0400 Original-Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-71e49ef3b2bso1138923b3a.2 for <73991@debbugs.gnu.org>; Thu, 24 Oct 2024 20:45:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zonu-me.20230601.gappssmtp.com; s=20230601; t=1729827882; x=1730432682; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=nMeiEzOX5oZNYUkNmL6AvYe5x/trCgUY5BDQIk2tnHg=; b=UrstZ6WOlQ0uB8kgait1LbTnUJLHE6vqGSqsLOtl8e12e91yKtNlwDzCEvmis970pE IQEmti+wfQ7rFkJWtIXMRXybRgTmcp7z3NTj8u7FGBpuAcFbUARS5X/jm1Mdexm64TcL qWPtKTqrrwN8F6ypfzEouRKo2w2Lx0GidTSOV+CaLnJF/XhYEvfT1XBc6PlBFeRipvcz OoUXPVU3jSd/Uj/d12dbDcJU2YBl1btxYIevARcV9kFHWEhXa7nC32tHR0IGDRJij5sG ghpI2O79cJpQxaRgIVBuVUYNkrZQ0wDH70KY53/bODSJiyYz23J0PP3JBd3xz0HawiFC N4lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729827882; x=1730432682; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=nMeiEzOX5oZNYUkNmL6AvYe5x/trCgUY5BDQIk2tnHg=; b=l4D8oSoFNb0KwGjYEsQhJhh4fEKk08dUF7NXlkzHxXuKe7yKLDLo+i0vIplbETqpJa A08tOGfXyTpQes0jmUPG+zr+cKpiEshjLND7qT40XfNTVGuH89dupZDXLusa5tYTZJhq 4/YfhHs3kK5pseP1DeiMJ1Lgq/ray8jdEzpqQihfCDUT3mlEk0oujUI8Bs3ebnMoeZTz rRaPHlw5tN3Z6PZpI0YUl4ZcUPo9ZBPv0G7GOTnSUIJAUwdTIZJNhnNFin5OhTCT3gEl QdjtIzxTYSYxggycXkdwOTpY41VJVfdFP/2ldSnGhIlIFBgafwudK23AHKRalMoexUnF 6OBA== X-Gm-Message-State: AOJu0Yx/zPmsKx2415O4uPUdJu+4vniGab8pvaCNPWLsCddvhe0IZpKK kbajZD4PVNpwAFnKDDo0m0PkNOExIOioWC1m49V+QL4IfobWDYwug7mlAxF9IW12m89EthglyNP /2krR5RK7kakfM9lvzrdOdi80cFpIrzLSg3L/Ug== X-Google-Smtp-Source: AGHT+IEiHCoq2grZjOX87fNo0z8Oc4HJvUKVXGgmUUHuEMoBUu209DaoQIuVuXgc2QlnQ68kHGCc07o4F0VmCugIusQ= X-Received: by 2002:a05:6a00:2d02:b0:720:2eda:dfd1 with SMTP id d2e1a72fcca58-72030b67281mr11236607b3a.18.1729827882168; Thu, 24 Oct 2024 20:44:42 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:294208 Archived-At: --00000000000070b96d062544f06c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Stefan, > You can get the same behavior with > > indent_size =3D tab > tab_width =3D 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=E5=B9=B410=E6=9C=8825=E6=97=A5(=E9=87=91) 4:56 Stefan Monnier : > > In Emacs 30.0.91, the debugger does not respond when watching the > variable. > > You can get the same behavior with > > indent_size =3D tab > tab_width =3D 4 > > BTW, I think the patch below is in order: if the user sets > "indent_size=3Dtab", 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=3Dtab', they most likely prefer > + ;; `indent_style=3Dtab' as well. > + (when (and (null style) (equal size "tab")) > + (setq style "tab")) > + > (setq size > (cond ((editorconfig-string-integer-p size) > (string-to-number size)) > > --00000000000070b96d062544f06c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Stefan,

> You can get the same be= havior with
>
>=C2=A0 =C2=A0 indent_size =3D tab
>=C2= =A0 =C2=A0 tab_width =3D 4

The settings mean the same th= ing, but I contribute to several projects on GitHub, so it wouldn't mak= e sense to rewrite them all.

I accidentally replie= d to Eli about bug#72808 instead of to ML, so I'm resending it.

-----

I read bug #72808 and I do= n't quite understand what you and Stefan are saying.

> > Y= es, I consciously disagreed with the standard here.=C2=A0 IMO, this better<= br>> > reflects Emacs's habitual behavior, so it makes more sense= for Emacs users.
My feedback is as follows:

Without tab-width be= ing honored, editing code in a project based on this setting would easily c= ause Emacs to break the indentation of that file.
I've been an edito= rconfig-mode user since 2014 and I don't think the behavior is reasonab= le.
If that were the default behavior I could correct it with advice, bu= t 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 v= ia a customization variable.



<= div class=3D"gmail_quote">
2024=E5=B9= =B410=E6=9C=8825=E6=97=A5(=E9=87=91) 4:56 Stefan Monnier <monnier@iro.umontreal.ca>:
> In Emacs 30.0.91, the = debugger does not respond when watching the variable.

You can get the same behavior with

=C2=A0 =C2=A0 indent_size =3D tab
=C2=A0 =C2=A0 tab_width =3D 4

BTW, I think the patch below is in order: if the user sets
"indent_size=3Dtab", which means that the "indentation step&= quot; 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`?


=C2=A0 =C2=A0 =C2=A0 =C2=A0 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
=C2=A0 =C2=A0 =C2=A0(when tab_width
=C2=A0 =C2=A0 =C2=A0 =C2=A0(setq tab_width (string-to-number tab_width)))
+=C2=A0 =C2=A0 ;; When users choose `indent_size=3Dtab', they most like= ly prefer
+=C2=A0 =C2=A0 ;; `indent_style=3Dtab' as well.
+=C2=A0 =C2=A0 (when (and (null style) (equal size "tab"))
+=C2=A0 =C2=A0 =C2=A0 (setq style "tab"))
+
=C2=A0 =C2=A0 =C2=A0(setq size
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(cond ((editorconfig-string-intege= r-p size)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (string-to-n= umber size))

--00000000000070b96d062544f06c--