Subject: bug#68899: Treesitter's forward-sexp-function

From: João Távora <[email-masked]>
Date: Mon, 5 Feb 2024 01:08:51 +0000

On Mon, Feb 5, 2024 at 12:50 AM Yuan Fu <[email-masked]> wrote:

> void main (void) {
>   <point>
> }<will move to here>

Ohhh, I didn't think about this case

> But I get you now; if we define “leaf thing” as not having any nested
child thing, and we allow ourselves to move to the end of leaf thing, then
in this case we indeed should move out of the closing bracket. I like your
definition of “leaf thing” better since it’s more general than “leaf node”,
and I like the simpler code too.
>
> So applied your patch with some comments added, thanks!

Errr... I'm very sorry, but now I think your previous patch makes more
sense -- precisely because of the above case, which now I understand
what you were arguing for.  I assume your patch indeed preserves that
property of NOT leaving the braces.

I think that's also how c++-mode works (and about all other
sexp-navigation) works.

So if we could go back ~12 hours and allow me to respond positively
to your initial patch, I think that would be perfect :-)

But I _guess_ you could defend many behaviours.  Maybe this "tactic"
argument should be exposed to the user in a variable.

Anyway, what there is now is already much less jarring than what there
was before.  The empty body is fairly rare.

João