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

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

bug#68824: treesitter support for outline-minor-mode


From: Yuan Fu
Subject: bug#68824: treesitter support for outline-minor-mode
Date: Sun, 4 Feb 2024 20:34:24 -0800


> On Feb 4, 2024, at 9:15 AM, Juri Linkov <juri@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




reply via email to

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