unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Jørgen Kvalsvik" <j@lambda.is>
To: Yuan Fu <casouri@gmail.com>
Cc: theo@thornhill.no, 74507@debbugs.gnu.org
Subject: bug#74507: [PATCH] Indent compounds c-ts-mode when { is not BOL
Date: Fri, 29 Nov 2024 10:04:36 +0100	[thread overview]
Message-ID: <6f6fbda2-ce84-4f85-8727-9d652473c6cb@lambda.is> (raw)
In-Reply-To: <66722213-91AB-45C1-BD99-2BF823485E63@gmail.com>

On 11/29/24 05:56, Yuan Fu wrote:
> 
> 
>> 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?

As Eli says, I have submitted the paperwork.

> 
> 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

Splendid, thanks.






  parent reply	other threads:[~2024-11-29  9:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-24  9:15 bug#74507: [PATCH] Indent compounds c-ts-mode when { is not BOL Jørgen Kvalsvik
2024-11-29  4:56 ` Yuan Fu
2024-11-29  7:54   ` Eli Zaretskii
2024-11-29  9:04   ` Jørgen Kvalsvik [this message]
2024-11-29  7:57 ` Eli Zaretskii
2024-11-29  9:05   ` Jørgen Kvalsvik
2024-11-30  0:16     ` Yuan Fu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6f6fbda2-ce84-4f85-8727-9d652473c6cb@lambda.is \
    --to=j@lambda.is \
    --cc=74507@debbugs.gnu.org \
    --cc=casouri@gmail.com \
    --cc=theo@thornhill.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).