Subject: Re: 30.0.50; c/c++ tree sitter forward-sexp problem

From: Eli Zaretskii <[email-masked]>
Date: Thu, 06 Apr 2023 13:12:01 +0300

> Date: Mon, 20 Mar 2023 21:40:26 +0100
> From: "Herman, Geza" <[email-masked]>
> 
> With tree sitter, forward-sexp behaves a little strange. To reproduce:
>   - copy the little example program below into a c++-ts-mode buffer
>   - move the point to the opening curly brace of "main() {"
>   - M-x forward-sexp
> 
> This will move the point to the space character in "int a;". But without 
> tree sitter, this moves the point to the closing brace of main (I 
> believe this is the correct behavior).
> 
> I noticed this problem because hideshow behaves strangely with tree sitter:
>   - enable hideshow mode (M-x hs-minor-mode)
>   - move the point to the same opening brace
>   - M-x hs-toggle-hiding
> 
> Hideshow should hide the whole body of main, but instead it only hides 
> parts of the body, and the buffer ends up like this:
> 
> int main() {... a;
>      }
>     int b;
> }
> 
> If I set forward-sexp-function to nil, the problem goes away. I think 
> this issue is somewhat related to #60894
> 
> Here's the little example program:
> 
> int main() {
>      if (false) {
>          int a;
>      }
>      int b;
> }

Theo, Yuan: any comments?  Can you look into fixing this?

Thanks.