From: Eli Zaretskii Date: Sat, 20 Apr 2024 06:53:35 +0000 (+0300) Subject: ; Fix documentation of recent commits related to treesit X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=058ad67537700eb11ea9ae2dc14b5247dc21c509;p=emacs.git ; Fix documentation of recent commits related to treesit * src/treesit.c (Ftreesit_parser_changed_ranges): * doc/lispref/parsing.texi (Using Parser): Fix wording. (cherry picked from commit 42776dc5b7702cec2feb787fbf770d91623b9818) --- diff --git a/doc/lispref/parsing.texi b/doc/lispref/parsing.texi index 65672997bda..f79502f3bab 100644 --- a/doc/lispref/parsing.texi +++ b/doc/lispref/parsing.texi @@ -539,10 +539,10 @@ symbol, rather than a lambda function. This function returns the list of @var{parser}'s notifier functions. @end defun -Sometimes a user might want to synchronously get the changed ranges of -the last reparse, and @code{treesit-parser-changed-ranges} is just for -it. This function basically returns the @var{ranges} that the notifier -functions were passed. +Sometimes a Lisp program might need to synchronously get the changed +ranges of the last reparse. The function +@code{treesit-parser-changed-ranges} exists for this purpose. It +returns the ranges which were passed to the notifier functions. @defun treesit-parser-changed-ranges parser &optional quiet This function returns the ranges that has been changed since last @@ -552,8 +552,8 @@ mark the start and the end positions of a range. This function should almost always be called immediately after reparsing. If it's called when there are new buffer edits that hasn't -been reparsed, Emacs signals @code{treesit-unparsed-edits}, unless -@var{quiet} is non-nil. +been reparsed, Emacs signals the @code{treesit-unparsed-edits} error, +unless the optional argument @var{quiet} is non-nil. Calling this function multiple times consecutively doesn't change its return value; it always returns the ranges affected by the last reparse. diff --git a/src/treesit.c b/src/treesit.c index 76354361284..52d158b1bf8 100644 --- a/src/treesit.c +++ b/src/treesit.c @@ -1833,13 +1833,13 @@ DEFUN ("treesit-parser-changed-ranges", Ftreesit_parser_changed_ranges, 1, 2, 0, doc: /* Return the buffer regions affected by the last reparse of PARSER. -Returns a list of cons (BEG . END), where each cons represents a region -in which the buffer content was affected by the last reparse. +Returns a list of cons cells (BEG . END), where each cons cell represents +a region in which changes in buffer contents affected the last reparse. This function should almost always be called immediately after reparsing. If it's called when there are new buffer edits that hasn't -been reparsed, Emacs signals `treesit-unparsed-edits', unless QUIET is -non-nil. +been reparsed, Emacs signals the `treesit-unparsed-edits' error, unless +optional argument QUIET is non-nil. Calling this function multiple times consecutively doesn't change its return value; it always returns the ranges affected by the last