From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.bugs Subject: bug#61893: 29.0.60; Indentation in c-ts-mode broken again Date: Sat, 4 Mar 2023 15:03:46 -0800 Message-ID: <3A152DB8-DA88-4E40-A536-4514E2C3501A@gmail.com> 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> <5F5AF93A-E0A8-47BF-97DB-1AAA9A025FA4@thornhill.no> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.400.51.1.1\)) 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="23307"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , 61893@debbugs.gnu.org, Daniel =?UTF-8?Q?Mart=C3=ADn?= To: Theodor Thornhill Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Mar 05 00:05:16 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 1pYawF-0005qf-VU for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 05 Mar 2023 00:05:16 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pYaw5-0002Db-Bv; Sat, 04 Mar 2023 18:05:05 -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 1pYaw2-0002Cw-T8 for bug-gnu-emacs@gnu.org; Sat, 04 Mar 2023 18:05: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 1pYaw2-0001lC-Kg for bug-gnu-emacs@gnu.org; Sat, 04 Mar 2023 18:05:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pYaw2-0008JK-FQ for bug-gnu-emacs@gnu.org; Sat, 04 Mar 2023 18:05:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 04 Mar 2023 23:05:02 +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.167797104831820 (code B ref 61893); Sat, 04 Mar 2023 23:05:02 +0000 Original-Received: (at 61893) by debbugs.gnu.org; 4 Mar 2023 23:04:08 +0000 Original-Received: from localhost ([127.0.0.1]:38019 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pYav9-0008HA-VY for submit@debbugs.gnu.org; Sat, 04 Mar 2023 18:04:08 -0500 Original-Received: from mail-pj1-f44.google.com ([209.85.216.44]:39761) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pYav7-0008Fr-7L for 61893@debbugs.gnu.org; Sat, 04 Mar 2023 18:04:05 -0500 Original-Received: by mail-pj1-f44.google.com with SMTP id 6-20020a17090a190600b00237c5b6ecd7so9622965pjg.4 for <61893@debbugs.gnu.org>; Sat, 04 Mar 2023 15:04:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1677971039; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=UP8zKRXnAO4fLdzdswNxtUyT6Bs3V+q1dr7ACmOSkko=; b=gyV3L/3cpCPjaHuzFXzmXwtslh221dYtft50RlCoMA6F3h07JAUilnBniOsAxmqGoa 93eksFh1CYmgN8UU6ojORAlmMCeFgIKYql0nBcNUyTTP532lHM0lX/jEtacxHVGyqKEm LsXuujXtsi1tgO5emy0KoRxDHvEbgbFOQadxVMbTRKYpwk9SW2DijqwRrRnlf1VXxDC6 DVKP3dJK9snsMSJ2TPIV6aYoAaGWBWENRFiySmdAcxevTPZrLSvzFa43GcEIIEP1KGPd onDxnt6zLrE/sAsY2OLgajJoFSEppexT+j831ct22o0/8pgsmwbBDByi+hxF+zrzH2DZ R88A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677971039; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UP8zKRXnAO4fLdzdswNxtUyT6Bs3V+q1dr7ACmOSkko=; b=uCBZTPeOkUXhl3XNuQ6j7WR8QJYTAun7GoLkkyEBYmX9Is5RkL1L7CH7lAYRipPkqg m15PJ4ylGX8QjPPBRLUbxnQPiMWnYUA2YlqsXFsASNVAC9cBM5/l5srozRj3CGHufX3j UnjlH6wJGWkTfNoY03oGbinZTT+X0LCB69yLjpMYwFBw31sZXdOac1UsHgr+pcPH2J4z aGScP9Pj5NmWP4etDEfBUTjPQKtNIvaQUB4V4eEN6iLWB3oqUyeGWVFTb5UUtW27eTVe JvGLWeKzTaH1iYEwXiQBeMi1S9yb3p6suGY8Ci8Fqk8nZWSOD9s2NfvWtHJmG5eIHZjN RmJw== X-Gm-Message-State: AO0yUKVk49yTrLJiD2JXNBVoMoCnR4zoQGTLazvf53GaWWr5gBYwUzkn XDfoxiJJradovgMAMJxaQtI= X-Google-Smtp-Source: AK7set+SqyCcwF924+71crpRQWRzP73hWLFp5ZOYo19Mblvk8QI2rPHukZV+N0SJZ8rkHT4vt3gfEg== X-Received: by 2002:a17:902:9b8a:b0:19a:acc2:73e4 with SMTP id y10-20020a1709029b8a00b0019aacc273e4mr5824391plp.22.1677971039496; Sat, 04 Mar 2023 15:03:59 -0800 (PST) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id b2-20020a170903228200b001994a0f3380sm3772177plh.265.2023.03.04.15.03.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 04 Mar 2023 15:03:59 -0800 (PST) In-Reply-To: <5F5AF93A-E0A8-47BF-97DB-1AAA9A025FA4@thornhill.no> X-Mailer: Apple Mail (2.3731.400.51.1.1) 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:257322 Archived-At: > On Mar 4, 2023, at 12:54 AM, Theodor Thornhill = wrote: >=20 >=20 >=20 > On 3 March 2023 23:01:39 CET, Yuan Fu wrote: >>=20 >>=20 >>> On Mar 2, 2023, at 10:07 PM, Theodor Thornhill = wrote: >>>=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.gnu.org >>>>>>=20 >>>>>>> Thanks. So I wasn't dreaming after all. >>>>>>=20 >>>>>> Sorry about that. It should be fixed now. >>>>>=20 >>>>> Thanks, it's much better now. >>>>>=20 >>>>> I spotted the following problems, not sure if they are new or not: = go >>>>> to line 297 of dispnew.c, which is "#endif". Then type "C-e RET" = -- >>>>> point goes to column zero instead of the expected column 6. This >>>>> affects the following 3 lines as well; only the next 'if' fixes = the >>>>> indentation. I see the same problem with every "#endif" line. >>>>>=20 >>>>> Line 6584 of dispnew.c, 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.c is just "#else"; typing "C-e RET" there >>>>> unexpectedly goes to column 2 instead of 4. >>>>=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. I=E2=80=99ve fixed it. Theo, while working on this, I = found some problem with the current indent for preproc directives. 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. Looking at the parsed tree, the elif directives are = nested in the if directive, and the nesting can be arbitrarily deep. We = probably need a custom function rather than great-grand-parent to find = the anchor, like a function that keeps going up the tree until the node = isn=E2=80=99t a preproc directive anymore. >>>>=20 >>>> Yuan >>>=20 >>> Yeah, you're right. 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 improve it :) >>=20 >> Absolutely, I=E2=80=99ll work on it.=20 >>=20 >> Yuan >=20 > Thanks :) Done!