; Fix recently-updated documentation

* doc/lispref/modes.texi (Parser-based Indentation): Fix markup,
typos and wording.
This commit is contained in:
Eli Zaretskii 2024-12-02 14:11:00 +02:00
parent 8cd4ab7abd
commit a79c300a88

View file

@ -5245,11 +5245,12 @@ more complex indentation engines.
@defvar treesit-simple-indent-rules
This local variable stores indentation rules for every language. It is
an list of elements of the form @w{@code{(@var{language}
@var{rule}...)}}, where @var{language} is a language symbol, and each
@var{rule}@dots{})}}, where @var{language} is a language symbol, and each
@var{rule} is either a list with elements of the form
@w{@code{(@var{matcher} @var{anchor} @var{offset})}}, or a function. Let
's focus on the list variant first, we'll come back to the function
variant later.
@w{@code{(@var{matcher} @var{anchor} @var{offset})}}, or a function.
Here's the description of the list variant, followed by the function
variant.
First, Emacs passes the smallest tree-sitter node at the beginning of
the current line to @var{matcher}; if it returns non-@code{nil}, this
@ -5280,14 +5281,13 @@ or a function that returns an integer. If it is a function, it is
passed @var{node}, @var{parent}, and @var{bol}, like matchers and
anchors.
Remember that @var{rule} can also be a function. This is for the
complex cases where a rule needs to consider the matching rule and
anchor together. If @var{rule} is a function, it's passed the same
argument as @var{matcher}: @var{node}, @var{parent}, and @var{bol}. If
it matches, @var{rule} should return a cons @w{@code{(@var{anchor-pos}
. @var{offset})}}, where @var{anchor-pos} is a buffer position, and
@var{offset} is the indent offset. If @var{rule} does't match, it
should return @code{nil}.
If @var{rule}is a function, it is useful for the complex cases where a
rule needs to consider the matching rule and the anchor together. The
@var{rule} function is passed the same argument as @var{matcher}:
@var{node}, @var{parent}, and @var{bol}. If it matches, @var{rule}
should return a cons @w{@code{(@var{anchor-pos} . @var{offset})}}, where
@var{anchor-pos} is a buffer position, and @var{offset} is the indent
offset. If @var{rule} doesn't match, it should return @code{nil}.
@end defvar
@defvar treesit-simple-indent-presets