Subject: bug#61502: 29.0.60; c-ts-mode auto-indent not working

From: Theodor Thornhill <[email-masked]>
Date: Wed, 15 Feb 2023 18:14:46 +0100

On 15 February 2023 18:09:18 CET, Eli Zaretskii <[email-masked]> wrote:
>> Date: Wed, 15 Feb 2023 16:48:33 +0100
>> From: Theodor Thornhill <[email-masked]>
>> CC: [email-masked], [email-masked], [email-masked]
>> 
>> 
>> 
>> On 15 February 2023 16:02:03 CET, Eli Zaretskii <[email-masked]> wrote:
>> >> From: Theodor Thornhill <[email-masked]>
>> >> Cc: [email-masked], [email-masked], [email-masked]
>> >> Date: Wed, 15 Feb 2023 15:53:22 +0100
>> >> 
>> >> >> int
>> >> >> main
>> >> >> {
>> >> >>   for (;;)
>> >> >> |
>> >> >> 
>> >> >> eval: (treesit-node-at (point)) ;; #<treesit-node ")" in 21-22>
>> >> >
>> >> > I'm afraid I cannot interpret that.  What does it mean?
>> >> 
>> >> It returns the closing paren in "for (;;)", right before point.  Which
>> >> may not be as useful, as it is a child of for_statement, IIRC.  Making a
>> >> rule for that isn't too hard, but it complicates things.
>> >
>> >Hmm... this might make no sense, but: why are we asking about the node
>> >at point?  For indentation purposes, when RET is pressed, shouldn't we
>> >ask about the node of the first non-whitespace character of the line
>> >where we get RET?
>> 
>> Yeah, but what then to do when there is only whitespace?
>
>Look back for the first line that has something other than whitespace?

Yeah, we could. But what then with

for (
     ;;)
|

?

Not saying it's impossible, but we will get complexity that may be hard to get into emacs-29, i think.

Theo