From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?=E8=B5=B5_?= =?UTF-8?Q?=E7=BA=AA=E9=98=B3?= Newsgroups: gmane.emacs.bugs Subject: bug#61142: =?UTF-8?Q?=E5=9B=9E=E5=A4=8D:?= bug#61142: 29.0.60; java-ts-mode - Wrong indentation for the body of multiple lines conditions Date: Sun, 5 Feb 2023 13:09:19 +0000 Message-ID: References: <87wn4x7lpw.fsf_-_@thornhill.no> <87r0v47dky.fsf@thornhill.no> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="_000_OSZP286MB141720BF3D08F8E5195C4FAFA8D59OSZP286MB1417JPNP_" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33326"; mail-complaints-to="usenet@ciao.gmane.io" Cc: "61142@debbugs.gnu.org" <61142@debbugs.gnu.org> To: Theodor Thornhill Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 06 06:52:43 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 1pOuQk-0008TD-ND for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 06 Feb 2023 06:52:42 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pOuQA-0001Vo-K4; Mon, 06 Feb 2023 00:52:06 -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 1pOuQ8-0001V4-7p for bug-gnu-emacs@gnu.org; Mon, 06 Feb 2023 00:52:04 -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 1pOuQ7-0004MF-V1 for bug-gnu-emacs@gnu.org; Mon, 06 Feb 2023 00:52:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pOuQ7-0003fr-QB for bug-gnu-emacs@gnu.org; Mon, 06 Feb 2023 00:52:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?=E8=B5=B5_?= =?UTF-8?Q?=E7=BA=AA=E9=98=B3?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 06 Feb 2023 05:52:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61142 X-GNU-PR-Package: emacs Original-Received: via spool by 61142-submit@debbugs.gnu.org id=B61142.167566270114028 (code B ref 61142); Mon, 06 Feb 2023 05:52:03 +0000 Original-Received: (at 61142) by debbugs.gnu.org; 6 Feb 2023 05:51:41 +0000 Original-Received: from localhost ([127.0.0.1]:47191 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOuPk-0003eB-Qt for submit@debbugs.gnu.org; Mon, 06 Feb 2023 00:51:41 -0500 Original-Received: from mail-psaapc01olkn2047.outbound.protection.outlook.com ([40.92.52.47]:6625 helo=APC01-PSA-obe.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOem1-00059r-QA for 61142@debbugs.gnu.org; Sun, 05 Feb 2023 08:09:38 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WFQPE2TAAH45qafj5OEyrQu7F3Q1c7WDN7r/rWaGbHf5eOJyicQXASiWCnHHhrPRXdocNP4KffzffA50Y8qURaby0MbcKvek/f3+g3661o/hpphd/ntoy70ZhHW/gm/H0r0MYTliovl403wMg3BU0F+zvD+0PPYQAB5hs3bl94gUuJJxyIpjWfDHw4UUu0iHfaKOIxpPHCM/s6VPinr3kwkhqBvM5EXMEEwsfJsjcNg7iwIPnrc7DRVuL0swswkk1Lxu73PtWNNNTO1BTTuWznLTnrA+INllKsKHFZ7SZjugQzmmmDDuv11N+M74TKFnA0k9r098fHpgHF2WKovyeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=pHma/0g1IoeTNYRgNdLcxomq8UqgvdsDceEPej361Ic=; b=AmlY4Xee/HX0tFeXNIqvP++sH5tM9n4s4iz9moTp/wbbtrniPK+g3mAi0E2F0lSpyZiTrgMPO3pPkzJLMa7kFnL1/9eFxDdY45f85SMXa13Y4RHBNcoNoxgae/bQ5Fm1EIkUaECYbHN/LM2cmZrJCKNVUo7QIkzl8ECYwDdiBgJauZNQYHRmbeaUppXQnafr/lMW0IuVqfIEXvJVCNpo7cJDSGiRcMiQrFDJQJvO2Xm8uBTGAfnWtkPkSqjqJCmuO9khQ5MFqLL0CA7dDCFgU82uInKCpDGSqBz4hXhTv530rjqfSTllVOt9+vCDxwdEOwrcPBCtyw1nz38Zj6wTJg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pHma/0g1IoeTNYRgNdLcxomq8UqgvdsDceEPej361Ic=; b=Qd02gCs2vOhXM2WCB7VqWUu+WpuiVVTjpxPUwh+2mUHoD/Do2F7/I+yf8y/qdtQxXIC9zIwgcllAwqkRH9w+aH0vF22camk9k4Wvoi0cfw9czq6r9s3Ew4ED5rJJbp6uAyx/UhrAmOEl7AY5A8xAqNOP6uyoQFRqs85p/oCkaiBdj5bgoAMNqLLmj1d+4h+Y58dySxVIdnzdlX2g3S3yOq17MnLZ5aHbPXB1Zg8P/vrk1LnCUdj1ozuYX6s1a4hjUsOS+hQh/QXYo9o5FZzhtZ6xllGXFtM9bBfWbo6XBGjAktNSYtCeX1qH1SREBu0VWmJdIMbunhNuNvJpMVu94Q== Original-Received: from OSZP286MB1417.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:13e::13) by TYWP286MB3349.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:2da::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.34; Sun, 5 Feb 2023 13:09:19 +0000 Original-Received: from OSZP286MB1417.JPNP286.PROD.OUTLOOK.COM ([fe80::c3e:9933:93cd:8cfa]) by OSZP286MB1417.JPNP286.PROD.OUTLOOK.COM ([fe80::c3e:9933:93cd:8cfa%5]) with mapi id 15.20.6064.034; Sun, 5 Feb 2023 13:09:19 +0000 Thread-Topic: bug#61142: 29.0.60; java-ts-mode - Wrong indentation for the body of multiple lines conditions Thread-Index: AQHZOIXR1teovax0pkiAxqIpffDvG66//N8TgABX6BU= In-Reply-To: <87r0v47dky.fsf@thornhill.no> Accept-Language: zh-CN, en-US Content-Language: zh-CN x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [vUJLFp/2vtvdNX38+SrjqqwKq5dVQ3UH] x-ms-publictraffictype: Email x-ms-traffictypediagnostic: OSZP286MB1417:EE_|TYWP286MB3349:EE_ x-ms-office365-filtering-correlation-id: 29cfc424-7b5a-4938-9836-08db077a3112 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: uqqVlLm03we96i70QOR/oPNtzTjuUGyqPhAFP/fwrgl8Swoi6IN1GLEyAa3AYYnN/1FSq8kHvl5AxecVUVDncHq+hx0XK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1OiKFgFgM9NxVHROA3ir/eW0u5vD4fAUww6K4u5evzPC7Oj08voBGDTCaaVC/bXFotvP0G0UJjgu0dLOXsQEWmQMkJMG8pxagH7hOQkELxSDjG0cQpoRmBEB+wRtoPVcAbcXFtcZLZRF2dfxqztWE9H5RR8A+LbOWktbUm4sZPJHrO1xVeVfxNEX87jPUjzmMGTijxVjFcOlUHfRet0QIRqHM6Y2jPnVL4XO4X2E3hk4ZSYB4THkhWB6o6Kv9D0gEK70 n508ukt0PYj0Xbbzr58m2jPUnan4OW07TKfycREmRiRWV+4iXCKAOH9dNcK/IPc5Dk2ShvVGITRFSLOh3LdhGKsGkrLr1QoY6V X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-05f45.templateTenant X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: OSZP286MB1417.JPNP286.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 29cfc424-7b5a-4938-9836-08db077a3112 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Feb 2023 13:09:19.3452 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYWP286MB3349 X-Mailman-Approved-At: Mon, 06 Feb 2023 00:51:39 -0500 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:254937 Archived-At: --_000_OSZP286MB141720BF3D08F8E5195C4FAFA8D59OSZP286MB1417JPNP_ Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: base64 VGhhbmtzIGZvciB0aGUgcGF0Y2guDQoNCkkndmUgbm90IHRlc3RlZCB0aGlzIHBhdGNoIGFkZXF1 YXRlbHksIGJ1dCBJIGZvdW5kIGFuIGlzc3VlOg0KamF2YS10cy1tb2RlIGluZGVudHMgdGhlIGJv ZHkgb2YgYGVsc2UgaWZgIHdpdGggb25lIG1vcmUgbGV2ZWwgb2YgaW5kZW50YXRpb24uDQoNCmBg YA0KcHVibGljIGNsYXNzIFQgew0KICAgIGludCBmKCkgew0KICAgICAgICBpbnQgYSA9IDA7DQog ICAgICAgIGludCBiID0gMTsNCiAgICAgICAgaWYgKGEgPT0gMA0KICAgICAgICAgICAgJiYgYiA9 PSAxKSB7DQogICAgICAgICAgICAvLyBpbmRlbnRhdGlvbiBvaw0KICAgICAgICAgICAgcmV0dXJu IDA7DQogICAgICAgIH0gZWxzZSBpZiAoYSA9PSAxICkgew0KICAgICAgICAgICAgICAgIC8vIGlu ZGVudGF0aW9uIG1vcmUNCiAgICAgICAgICAgICAgICByZXR1cm4gMTsNCiAgICAgICAgICAgIH0N CiAgICB9DQp9DQpgYGANCklmIHRoZSBzZWNvbmQgYnJhbmNoIG9mIHRoZSBpZi1zdGF0ZW1lbnQg aXMganVzdCBhbiBgZWxzZWAgKG5vdCBgZWxzZSBpZmApLCB0aGUgYm9keSBvZiBpdCB3aWxsIGJl IGluZGVudGVkIGNvcnJlY3RseS4NCg0KDQpJJ3ZlIGFsc28gdGVzdGVkIGMtdHMtbW9kZSAodXNl ICdsaW51eCBhcyBjLXRzLW1vZGUtaW5kZW50LXN0eWxlKSBhbmQgaXQgYWxzbyBoYXMgdGhpcyBr aW5kIG9mIHByb2JsZW0uDQpgYGANCm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SZP286MB1417JPNP_ Content-Type: text/html; charset="gb2312" Content-Transfer-Encoding: quoted-printable
Thanks = for the patch.

I've not tested this patch adequately, but I found an issue: 
java-ts-mode= indents the body of `e= lse if` with one more level of indentation. 

```
public class T {
    int f(= ) {
     =   int a =3D 0;
     =   int b =3D 1;
     =   if (a =3D=3D 0
     =       && b =3D=3D 1) {
     =       // indentation ok
     =       return 0;
     =   } else if (a =3D=3D 1 ) {
     =           // indentation more
     =           return 1;
     =       }
    }
}
```
If the second branch= of the if-statement is just an `else` (not `else if`), the body of it will= be indented correctly.


I've also tested c-t= s-mode (use 'linux as c-ts-mode-indent-style) and it also has this kin= d of problem. 
```
int main() {
    = int a =3D 0;
    = if (a =3D=3D 0) {
    =     // indentation ok
    = } else if (a =3D=3D 2) {
    =         // indentation more
    =     }
}
```


=B7=A2=BC=FE=C8=CB: Theodor= Thornhill <theo@thornhill.no>
=B7=A2=CB=CD=CA=B1=BC=E4: 2023=C4=EA2=D4=C25=C8=D5 15:53
=CA=D5=BC=FE=C8=CB: =CC=AB=D1=F4 <zjyzhaojiyang@hotmail.com> =B3=AD=CB=CD: 61142@debbugs.gnu.org <61142@debbugs.gnu.org> =D6=F7=CC=E2: Re: bug#61142: 29.0.60; java-ts-mode - Wrong indentati= on for the body of multiple lines conditions
 
Theodor Thornhill <theo@thornhill.no> writes= :

> =CC=AB=D1=F4 <zjyzhaojiyang@hotmail.com> writes:
>
>> After reading treesit's manual, I found that we can use `n-p-gp` a= s the matcher
>> and `grand-parent` as the anchor to match the body of `if` (and `w= hile`, which
>> has a similar issue).
>>
>> I mean a rule looks like the following:
>>
>> ```
>> ((n-p-gp nil "block" "if_statement") grand-par= ent java-ts-mode-indent-offset)
>> ```
>>
>>
>
>
> Thanks!  We have a mechanism in place for this, see
> 'c-ts-common-statement-offset' in 'c-ts-common.el'.  I didn't get= to it
> yet, but I'll try to look at it this evening, unless you want to? = ; See
> c-ts-mode for examples of how to use it, if you're interested!
>
> Theo

Hi again!

Can you test this patch for me?

@Eli: Is this ok for emacs-29?  I'd love to add some test for this, bu= t
now they are on the master branch.  What is the common procedure to mo= ve
stuff from master branch to the release branch?  I _can_ just add some=
test to the master branch, but it would be nice to have them on emacs-29 too :-)

Theo

--_000_OSZP286MB141720BF3D08F8E5195C4FAFA8D59OSZP286MB1417JPNP_--