From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Theodor Thornhill via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#61893: 29.0.60; Indentation in c-ts-mode broken again Date: Sat, 04 Mar 2023 09:54:29 +0100 Message-ID: <5F5AF93A-E0A8-47BF-97DB-1AAA9A025FA4@thornhill.no> References: <83k000fsg8.fsf@gnu.org> <990CFB42-B7E4-4692-858B-20080B19A801@thornhill.no> <83a60wflwm.fsf@gnu.org> <835ybkfhuw.fsf@gnu.org> <3F6EB4C0-8216-4783-9DE4-0719F514F1B7@gmail.com> <83y1ofekaw.fsf@gnu.org> <3B2BAD9F-84AB-4243-AC98-95C52BA492E3@thornhill.no> <0476A0F0-75E4-45EF-9B18-ECC5E87851C1@gmail.com> Reply-To: Theodor Thornhill Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14070"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , 61893@debbugs.gnu.org, Daniel =?UTF-8?Q?Mart=C3=ADn?= To: Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Mar 04 09:55:12 2023 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 1pYNfb-0003R0-TA for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 04 Mar 2023 09:55:12 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pYNfU-0000nf-KF; Sat, 04 Mar 2023 03:55:04 -0500 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 1pYNfS-0000nT-Qy for bug-gnu-emacs@gnu.org; Sat, 04 Mar 2023 03:55:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pYNfS-0002mv-6R for bug-gnu-emacs@gnu.org; Sat, 04 Mar 2023 03:55:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pYNfR-0002XJ-Ix for bug-gnu-emacs@gnu.org; Sat, 04 Mar 2023 03:55:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 04 Mar 2023 08:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61893 X-GNU-PR-Package: emacs Original-Received: via spool by 61893-submit@debbugs.gnu.org id=B61893.16779200769710 (code B ref 61893); Sat, 04 Mar 2023 08:55:01 +0000 Original-Received: (at 61893) by debbugs.gnu.org; 4 Mar 2023 08:54:36 +0000 Original-Received: from localhost ([127.0.0.1]:35230 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pYNf1-0002WX-Lu for submit@debbugs.gnu.org; Sat, 04 Mar 2023 03:54:36 -0500 Original-Received: from out-7.mta0.migadu.com ([91.218.175.7]:10342) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pYNez-0002WM-J6 for 61893@debbugs.gnu.org; Sat, 04 Mar 2023 03:54:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1677920071; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mLV55bjDrM61nJxal8tt7hJvA+vrQZ72Nfoofh9X+LI=; b=0yC5RuZh8xsQ/6FDF9Oz85UMWwiKYMeID+8XMAnuh1urxQnoucSbGQaF0MUqA5r+l9ynpR kuwO2CqVVu4AZ1/MFzPxoyZn+LdVX+enN7RkehrL7btSJarP0R3x4f9Qjd7g4IQ/XS1yfZ bHyIUgsnxBKoIlpG45PDvB+jDOzqrnvmzAzxcsvr+KlPcycKNxEeM7uRKelZdar5RTm0N8 q85KfNr2qJnSgjKO3yscrmzuYp44yIp6xIXyFcfq6Ivxu5bHqhdIaHNCljfQoxp89q/M9J PtEUWaGBSMPAf+nX4sapOFmIVgz1pY1AqtlecU5Fu3l5IfD9rsD3ibyU4JalUg== X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. In-Reply-To: <0476A0F0-75E4-45EF-9B18-ECC5E87851C1@gmail.com> X-Migadu-Flow: FLOW_OUT 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:257260 Archived-At: On 3 March 2023 23:01:39 CET, Yuan Fu wrote: > > >> On Mar 2, 2023, at 10:07 PM, Theodor Thornhill wr= ote: >>=20 >>=20 >>=20 >> On 3 March 2023 05:07:44 CET, Yuan Fu wrote: >>>=20 >>>=20 >>>> On Mar 1, 2023, at 10:31 PM, Eli Zaretskii wrote: >>>>=20 >>>>> From: Yuan Fu >>>>> Date: Wed, 1 Mar 2023 14:08:23 -0800 >>>>> Cc: Daniel Mart=C3=ADn , >>>>> Theodor Thornhill , >>>>> 61893@debbugs=2Egnu=2Eorg >>>>>=20 >>>>>> Thanks=2E So I wasn't dreaming after all=2E >>>>>=20 >>>>> Sorry about that=2E It should be fixed now=2E >>>>=20 >>>> Thanks, it's much better now=2E >>>>=20 >>>> I spotted the following problems, not sure if they are new or not: go >>>> to line 297 of dispnew=2Ec, which is "#endif"=2E Then type "C-e RET"= -- >>>> point goes to column zero instead of the expected column 6=2E This >>>> affects the following 3 lines as well; only the next 'if' fixes the >>>> indentation=2E I see the same problem with every "#endif" line=2E >>>>=20 >>>> Line 6584 of dispnew=2Ec, which is this: >>>>=20 >>>> #endif /* HAVE_WINDOW_SYSTEM */ >>>>=20 >>>> exhibits a slightly different incorrect behavior: "C-e RET" on that >>>> line moves point to column 7, not column 6, presumably to align with >>>> the "/*" of the comment? >>>>=20 >>>> Line 6608 of dispnew=2Ec is just "#else"; typing "C-e RET" there >>>> unexpectedly goes to column 2 instead of 4=2E >>>=20 >>> That=E2=80=99s indeed the =E2=80=9Calign to previous statement=E2=80= =9D=E2=80=99s fault, caused by preproc directives Theo was working on=2E I= =E2=80=99ve fixed it=2E Theo, while working on this, I found some problem w= ith the current indent for preproc directives=2E In the following example: >>>=20 >>> static void >>> free_glyph_pool (struct glyph_pool *pool) >>> { >>> if (pool) >>> { >>> #if defined GLYPH_DEBUG >>> int c =3D 1; >>> #endif >>> int check_this =3D 3; >>> #ifdef stuff >>> int c =3D 1; >>> #elif defined stuff >>> int e =3D 5; >>> #else >>> int d =3D 11; >>> #endif >>> int check_this =3D 3; >>> } >>> } >>>=20 >>> The elif directive=E2=80=99s and subsequent directives aren=E2=80=99t = indented properly=2E Looking at the parsed tree, the elif directives are ne= sted in the if directive, and the nesting can be arbitrarily deep=2E We pro= bably need a custom function rather than great-grand-parent to find the anc= hor, like a function that keeps going up the tree until the node isn=E2=80= =99t a preproc directive anymore=2E >>>=20 >>> Yuan >>=20 >> Yeah, you're right=2E I'll see what I can do, but bandwidth is a little= low at the moment, so if you have some extra time, don't hesitate to impro= ve it :) > >Absolutely, I=E2=80=99ll work on it=2E=20 > >Yuan Thanks :)