GNU bug report logs -
#68824
treesitter support for outline-minor-mode
Previous Next
Reported by: Juri Linkov <juri <at> linkov.net>
Date: Tue, 30 Jan 2024 17:42:02 UTC
Severity: wishlist
Tags: patch
Fixed in version 30.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
Message #43 received at 68824 <at> debbugs.gnu.org (full text, mbox):
> On Feb 4, 2024, at 9:15 AM, Juri Linkov <juri <at> linkov.net> wrote:
>
>> Instead of using treesit-search-forward, can you use
>> treesit-beginning-of-thing or treesit--navigate-thing to do what you want?
>> They handle the “child before parent” problem for you, and handles some
>> other edge cases.
>
> Thanks, I tried and it works.
>
> Probably treesit--navigate-thing is not internal anymore.
> Also the patch below uses treesit--thing-at that doesn't look
> internal either. So maybe two dashes could be removed from names.
Yeah, it’s more of a “Emacs internal” than “treesit.el internal”. I wanted to give myself some freedom to change the api, and they’ve indeed went through big changes since created.
I can covert them to single dash.
>
> Also a remaining question: why treesit-parent-until simply calls
> ‘(funcall pred node)’ instead of supporting the standard format
> that includes a regexp by using treesit-node-match-p?
>
> This causes such an inconvenience that for treesit-outline-level
> that uses treesit-parent-until there is a need to wrap a regexp
> in a lambda such as for html-ts-mode below.
Nothing other than my oversight :-) I pushed a change to master that fixes this.
As for the patch, I think treesit-outline-predicate could be set to a named function rather than a lambda generated on the fly, but I don’t have strong opinions about it (and maybe you have some reason to use a lambda?) Otherwise LGTM.
Yuan
This bug report was last modified 1 year and 176 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.