Subject: bug#62238: 30.0.50; Unusual interpretation of "S-expressions" in c-ts-mode

From: Yuan Fu <[email-masked]>
Date: Sat, 18 Mar 2023 01:00:16 -0700

> On Mar 17, 2023, at 2:52 AM, Philip Kaludercic <[email-masked]> wrote:
> 
> 
> X-Debbugs-CC: Theodor Thornhill <[email-masked]>, Yuan Fu <[email-masked]>
> 
> Take this code block, where | is the position of the point.
> 
> if (foo)|{
>  bar;
>  baz;
> }
> 
> When I press C-M-SPC to mark a "S-expression" (knowing that C doesn't
> consist of S-Expressions), then I would assume that the region from the
> current point until the closing bracket would be selected.  Instead I
> get the region from the point up until after the first semicolon.
> 
> When I press C-M-SPC again, I get the second one as well, but a third
> press refuses to go on.  So I never get the entire block.
> 
> I do not know if this is intentional, but it also applies to movement
> and killing.  This is also particularly unintuitive when matching pairs
> are highlighted (in this case the brackets), which always (?) matches
> the interpretation of sexp-commands.

I tested this on my Emacs session and vanilla session, and both marked to the closing bracket. I believe forward-sexp should just work by the syntax table. Perhaps it’s your config or something?

Yuan