From: "Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 60531@debbugs.gnu.org
Subject: bug#60531: 29.0.50; Some fixes and suggestions for the docstrings of treesit-parent-while and treesit-parent-until
Date: Tue, 03 Jan 2023 23:45:35 +0100 [thread overview]
Message-ID: <m1a62zgru8.fsf@yahoo.es> (raw)
In-Reply-To: m1a62zgru8.fsf.ref@yahoo.es
The docstring of treesit-parent-while says:
Return the furthest parent of NODE that satisfies PRED.
Return nil if none was found. PRED should be a function that
takes one argument, the parent node.
But, according to the source code, the first invocation of NODE passes
NODE itself, not its parent:
(let ((last nil))
(while (and node (funcall pred node))
The same happens with the docstring of treesit-parent-until.
Another suggestion I have is that "the furthest parent of NODE" is a bit
ambiguous (furthest from NODE or from the root?). I think it would be
more clear to say it will return the highest (ie. least deep) *ancestor*
of NODE. In 37.3 Retrieving Nodes, we introduce the concepts of
"higher" and "lower" when explaining Tree-sitter nodes, so using this
terminology consistently would avoid confusion.
next parent reply other threads:[~2023-01-03 22:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <m1a62zgru8.fsf.ref@yahoo.es>
2023-01-03 22:45 ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-01-05 7:35 ` bug#60531: 29.0.50; Some fixes and suggestions for the docstrings of treesit-parent-while and treesit-parent-until Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m1a62zgru8.fsf@yahoo.es \
--to=bug-gnu-emacs@gnu.org \
--cc=60531@debbugs.gnu.org \
--cc=mardani29@yahoo.es \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.