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

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

bug#62301: 29.0.60; treesit-parent-while should mention that the return


From: Yuan Fu
Subject: bug#62301: 29.0.60; treesit-parent-while should mention that the return value may include the initial node
Date: Tue, 21 Mar 2023 14:52:19 -0700

daanturo <daanturo@gmail.com> writes:

> For the current implementation of `treesit-parent-while`, it will return
> the initial argument NODE who satisfies PRED while its immediate parent
> doesn't. But the docstring, when mentioning return values, only said
> about "parent" but not the child itself.
>
> For example, finding the node closest to the root that covers only
> exactly one of its descendant.
>
> (-let* ((node (treesit-node-at (point))))
>   (treesit-parent-while
>    node
>    (lambda (nd)
>      (and (= (treesit-node-start nd) (treesit-node-start node))
>           (= (treesit-node-end nd) (treesit-node-end node))))))
>
>
> I don't think that's a bug as it's useful to include the child
> sometimes, as the example above, but I think the docstring should
> clarify more.

Thanks for the report! I updated the docstring as you suggested.

Yuan





reply via email to

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