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: Fri, 03 Mar 2023 07:07:59 +0100 Message-ID: <3B2BAD9F-84AB-4243-AC98-95C52BA492E3@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> 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="19619"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 61893@debbugs.gnu.org, Daniel =?UTF-8?Q?Mart=C3=ADn?= To: Yuan Fu , Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Mar 03 07:09: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 1pXybU-0004u0-1t for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 03 Mar 2023 07:09:16 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXybI-0007cX-LN; Fri, 03 Mar 2023 01:09: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 1pXybG-0007bq-Qr for bug-gnu-emacs@gnu.org; Fri, 03 Mar 2023 01:09: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 1pXybG-0004Cq-Af for bug-gnu-emacs@gnu.org; Fri, 03 Mar 2023 01:09:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pXybG-0008MQ-4J for bug-gnu-emacs@gnu.org; Fri, 03 Mar 2023 01:09:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 03 Mar 2023 06:09: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.167782368632071 (code B ref 61893); Fri, 03 Mar 2023 06:09:02 +0000 Original-Received: (at 61893) by debbugs.gnu.org; 3 Mar 2023 06:08:06 +0000 Original-Received: from localhost ([127.0.0.1]:59448 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pXyaL-0008LC-Ts for submit@debbugs.gnu.org; Fri, 03 Mar 2023 01:08:06 -0500 Original-Received: from out-1.mta1.migadu.com ([95.215.58.1]:52607) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pXyaJ-0008L2-DC for 61893@debbugs.gnu.org; Fri, 03 Mar 2023 01:08:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1677823681; 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=g/CH50lZQtvLu1rEnj9Gq7gbc6iex+O4I4D4H+ROtMQ=; b=CWlMTBWS3jIicJ6ZJmP5goN/GPqqMWCQKYw5/8NJUlE1j+X0fdjZEyVeI3k/QCZVLwwgON uFHEdcql9GbbsrJFgzR4onX2Bodhv+E5F40fAxgmjz5Ws+jTh7M4DEtSdnbFEZH2NAtpxg jEx/p9W/ORfqqDIBC+Cxl+zkbFk+QAQmyaPuU6h5mSTVKkkVlrlfsP9VA6kHZvsd7eE/D3 FHiAQvHBusvCw6sO4z900BbaNRhBpTJHF4xUXMZkbmfq54x8Z1RZuTRJpHTjc+yECOhXSY zw0ZcGpdBLUO3lCwWhtujF3CT05he6Z55lF+5P8P2hHsdBI0JuO8ER9kY+dLow== X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. In-Reply-To: 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:257193 Archived-At: On 3 March 2023 05:07:44 CET, Yuan Fu wrote: > > >> 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 > >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 with= the current indent for preproc directives=2E In the following example: > >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; > } >} > >The elif directive=E2=80=99s and subsequent directives aren=E2=80=99t ind= ented properly=2E Looking at the parsed tree, the elif directives are neste= d in the if directive, and the nesting can be arbitrarily deep=2E We probab= ly 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=2E > >Yuan Yeah, you're right=2E I'll see what I can do, but bandwidth is a little lo= w at the moment, so if you have some extra time, don't hesitate to improve = it :) Theo