GNU bug report logs - #76908
31.0.50; Extending c-ts-common-baseline-indent-rule

Previous Next

Package: emacs;

Reported by: jm <at> pub.pink

Date: Mon, 10 Mar 2025 02:56:02 UTC

Severity: wishlist

Found in version 31.0.50

Done: john muhl <jm <at> pub.pink>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: john muhl <jm <at> pub.pink>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#76908: closed (31.0.50; Extending c-ts-common-baseline-indent-rule)
Date: Tue, 11 Mar 2025 17:18:03 +0000
[Message part 1 (text/plain, inline)]
Your message dated Tue, 11 Mar 2025 12:09:24 -0500
with message-id <87ikof4hfk.fsf <at> pub.pink>
and subject line Re: bug#76908: 31.0.50; Extending c-ts-common-baseline-indent-rule
has caused the debbugs.gnu.org bug report #76908,
regarding 31.0.50; Extending c-ts-common-baseline-indent-rule
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
76908: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=76908
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: jm <at> pub.pink
To: bug-gnu-emacs <at> gnu.org
Subject: 31.0.50; Extending c-ts-common-baseline-indent-rule
Date: Sun, 09 Mar 2025 21:55:24 -0500
Hi Yuan.

I’ve been working on replacing some of the bespoke indentation
rules in lua-ts-mode with c-ts-common-baseline-indent-rule and ran
into one spot it didn’t handle.

If the parent (table, args, params) starts with a comment all the
siblings follow that indentation instead of ignoring the comment
and falling back to the default indent-offset; e.g.

  -- currently lua-ts-mode indents like:
  local my_table = { -- there is a comment here
      x_offset = 12,
      y_offset = 30,
  }

  -- using c-ts-common-baseline-indent-rule we get:
  local my_table = { -- there is a comment here
                     x_offset = 12,
                     y_offset = 30,
  }

And similarly for arguments & parameters:

  -- current:
  very_fun(-- do the very fun stuff
      "This is a string",
      3.1415926535897932,
      { x = 1, y = 2 },
  )

  -- c-t-c-b-i-r:
  very_fun(-- do the very fun stuff
           "This is a string",
           3.1415926535897932,
           { x = 123, y = 99 },
  )

Is this something it could be extended to do or should I just
stick with custom rules for this kind of thing?

Other than that it’s pretty much eliminated the need for all the
other rules I was using to get this stuff working.

Thanks.


[Message part 3 (message/rfc822, inline)]
From: john muhl <jm <at> pub.pink>
To: Yuan Fu <casouri <at> gmail.com>
Cc: 76908-done <at> debbugs.gnu.org
Subject: Re: bug#76908: 31.0.50; Extending c-ts-common-baseline-indent-rule
Date: Tue, 11 Mar 2025 12:09:24 -0500
Yuan Fu <casouri <at> gmail.com> writes:

>> On Mar 9, 2025, at 7:55 PM, jm <at> pub.pink wrote:
>> 
>> Hi Yuan.
>> 
>> I’ve been working on replacing some of the bespoke indentation
>> rules in lua-ts-mode with c-ts-common-baseline-indent-rule and ran
>> into one spot it didn’t handle.
>
> Glad to hear it’s getting used!
>
>> 
>> If the parent (table, args, params) starts with a comment all the
>> siblings follow that indentation instead of ignoring the comment
>> and falling back to the default indent-offset; e.g.
>> 
>>  -- currently lua-ts-mode indents like:
>>  local my_table = { -- there is a comment here
>>      x_offset = 12,
>>      y_offset = 30,
>>  }
>> 
>>  -- using c-ts-common-baseline-indent-rule we get:
>>  local my_table = { -- there is a comment here
>>                     x_offset = 12,
>>                     y_offset = 30,
>>  }
>> 
>> And similarly for arguments & parameters:
>> 
>>  -- current:
>>  very_fun(-- do the very fun stuff
>>      "This is a string",
>>      3.1415926535897932,
>>      { x = 1, y = 2 },
>>  )
>> 
>>  -- c-t-c-b-i-r:
>>  very_fun(-- do the very fun stuff
>>           "This is a string",
>>           3.1415926535897932,
>>           { x = 123, y = 99 },
>>  )
>> 
>> Is this something it could be extended to do or should I just
>> stick with custom rules for this kind of thing?
>
> The first example seems to work fine for me.

You’re right. I must of got Emacs into a funky state or had the
wrong file loaded or something.

> The second example is indeed a bug, I fixed it.

Works perfect now. Thanks.

> I tried 
>
> (defvar lua-ts--simple-indent-rules
>   `((lua
>      c-ts-common-baseline-indent-rule)))
>
> with
>
> (setq-local c-ts-common-indent-offset 'lua-ts-indent-offset)
> (setq-local c-ts-common-list-indent-style 'simple)
>
> (BTW you don’t need to set c-ts-common-indent-type-regexp-alist to use the baseline-indent-rule. I forgot to update the comment in Commentary.)
>
> Yuan


This bug report was last modified 124 days ago.

Previous Next


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