bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Yuan Fu
Subject: bug#68899: Treesitter's forward-sexp-function
Date: Mon, 5 Feb 2024 23:25:02 -0800


> On Feb 4, 2024, at 5:08 PM, João Távora <joaotavora@gmail.com> wrote:
> 
> On Mon, Feb 5, 2024 at 12:50 AM Yuan Fu <casouri@gmail.com> 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

No sweat. The empty body is fairly rare, and the current behavior isn’t 
annoying for empty body, I’d say. Consider that treesit--navigate-thing will be 
used on many other things besides sexp, a more general “leaf thing” is probably 
better suited for it.

Yuan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]