GNU bug report logs - #75650
30.0.93; Unexpected indentation of members of inner classes in java-ts-mode

Previous Next

Package: emacs;

Reported by: Hennes Märtins <hennes <at> maertins-zone.de>

Date: Sat, 18 Jan 2025 17:04:02 UTC

Severity: minor

Found in version 30.0.93

Full log


Message #16 received at 75650 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Hennes Märtins <hennes <at> maertins-zone.de>, 
 75650 <at> debbugs.gnu.org
Cc: Theodor Thornhill <theo <at> thornhill.no>
Subject: Re: bug#75650: 30.0.93; Unexpected indentation of members of inner
 classes in java-ts-mode
Date: Wed, 19 Feb 2025 13:19:50 -0800
Stefan Kangas <stefankangas <at> gmail.com> writes:

> Hennes Märtins <hennes <at> maertins-zone.de> writes:
>
>> Create a new java-ts-mode buffer with the following content:
>>
>> class Foo
>> {
>>     class Bar
>>     {
>>         int baz;
>>     }
>> }
>>
>> Indent the whole buffer (C-x h <tab>) and it becomes:
>>
>> class Foo
>> {
>>     class Bar
>>     {
>>             int baz;
>>     }
>> }
>>
>> The indentation level for baz becomes three, but I would expect it to be
>> two. A level of two is used in java-mode too.
>>
>> If I put the opening curly brace to the end of the previous line, the
>> indentation level becomes two as expected:
>>
>> class Foo {
>>     class Bar {
>> 	int baz;
>>     }
>> }
>>
>> I found a personal workaround for this by modifying the variable
>> java-ts-mode--indent-rules. I replace the entry:
>>
>> ((parent-is "class_body") column-0 c-ts-common-statement-offset)
>>
>> with:
>>
>> ((parent-is "class_body") parent-bol java-ts-mode-indent-offset)
>>
>> That works for me, but I am not sure if that is the correct solution.
>>
>> I can reproduce this also in:
>> GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0) of 2025-01-18
>
> Theodor, any comments here?

Friendly ping.

>> In GNU Emacs 30.0.93 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo
>>  version 1.16.0) of 2024-12-27 built on starlight
>> Repository revision: 186ea407326166ee4669ce6fe84871c1e16c657c
>> Repository branch: emacs-30
>> Windowing system distributor 'The X.Org Foundation', version 11.0.12101004
>> System Description: Ubuntu 22.04.5 LTS




This bug report was last modified 119 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.