GNU bug report logs - #70789
treesit navigate for outlines at bobp

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Sun, 5 May 2024 16:57:01 UTC

Severity: normal

Fixed in version 30.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: Yuan Fu <casouri <at> gmail.com>
Cc: 70789 <at> debbugs.gnu.org
Subject: bug#70789: treesit navigate for outlines at bobp
Date: Thu, 09 May 2024 09:28:59 +0300
close 70789 30.0.50
thanks

>>  (treesit-navigate-thing (point-min) 1 'beg "\\`\\(?:class\\|method\\)\\'")
>>
>> can't find "class" at the beginning of the buffer,
>> but after inserting an empty line before "class" it can find it.
>
> I see, from treesit-navigate-thing’s point of view, point is already at the
> beginning of a class, therefore the correct behavior is to go to the beg of
> the next class. Using ‘end is probably more appropriate here, but I know
> you must have good reasons to use ‘beg. How about using
> treesit-search-forward? Wait, am I the one that suggested
> treesit-navigate-thing to you, because it returns higher-leveled nodes
> first?

Indeed.

> In that case, maybe you can use treesit-thing-next to test if point is
> at the beginning of an outline header? That feels a bit easier to
> write and understand to me.

I don't see how treesit-thing-next could be used here since
quoting its doc:

  The returned node, if non-nil, must be after POS, i.e., its
  start >= POS.

> If you prefer the current patch I don’t have problem with it either.

Thanks, so now pushed.




This bug report was last modified 1 year and 12 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.