bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#74507: [PATCH] Indent compounds c-ts-mode when { is not BOL


From: Yuan Fu
Subject: bug#74507: [PATCH] Indent compounds c-ts-mode when { is not BOL
Date: Thu, 28 Nov 2024 20:56:26 -0800


> On Nov 24, 2024, at 1:15 AM, Jørgen Kvalsvik <j@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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]