GNU bug report logs -
#74507
[PATCH] Indent compounds c-ts-mode when { is not BOL
Previous Next
Reported by: Jørgen Kvalsvik <j <at> lambda.is>
Date: Sun, 24 Nov 2024 09:16:02 UTC
Severity: normal
Tags: patch
Done: Yuan Fu <casouri <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> On Nov 24, 2024, at 1:15 AM, Jørgen Kvalsvik <j <at> lambda.is> wrote:
>
> Tags: patch
>
> Tags: patch
>
>
> I found that the coumpounded statements are anchored to the wrong object
> when 1. the compound is not at beginning-of-line and 2. it is not
> preceeded by a construct such as fndecl/for/if/while/etc., which differs
> from how c-mode indents it.
>
> Non-BOL compound statements is actually quite common with macros and
> testing frameworks (see the test case). For example, you want this to
> indent:
>
> TEST_CASE(1) {
> assert (...);
> }
>
> The heuristic is quite course - it simply checks if the grandparent is
> function-definition or not, which is really if this node is a top-level
> sibling in the function body. If that is the case, the old rules should
> apply and standalone-parent should be the guide; otherwise, it should be
> the parent-BOL. This feels a bit shaky but does seem to work well for
> the test cases, and can be refined in the future.
>
> <0001-Indent-compounds-c-ts-mode-when-is-not-BOL.patch>
Thank you very much! Especially for the test case ;-) What’s the progress of your copyright assignment? Has it completed?
I’m working on refactoring the indentation rules for c-ts-mode. Let me see if I can integrate this situation into the new rules I’m writing.
Yuan
This bug report was last modified 229 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.