Fix tree-sitter markup in Elisp manual

* doc/lispref/parsing.texi (Retrieving Nodes, User-defined Things)
(Multiple Languages): Mark up variable names as @code, not
metasyntactic @var.
This commit is contained in:
Basil L. Contovounesios 2024-06-07 11:05:19 +02:00
parent 025c3eaf9c
commit 6dd3c6023e

View file

@ -932,7 +932,7 @@ This function repeatedly finds the parents of @var{node}, and returns
the parent that satisfies @var{predicate}. @var{predicate} can be
either a function that takes a node as argument and returns @code{t}
or @code{nil}, or a regexp matching node type names, or other valid
predicates described in @var{treesit-thing-settings}. If no parent
predicates described in @code{treesit-thing-settings}. If no parent
satisfies @var{predicates}, this function returns @code{nil}.
Normally this function only looks at the parents of @var{node} but not
@ -1536,7 +1536,7 @@ The ``things'' feature in Emacs is independent of the pattern matching
feature of tree-sitter, and comparatively less powerful, but more
suitable for navigation and traversing the parse tree.
You can define things with @var{treesit-thing-settings}.
You can define things with @code{treesit-thing-settings}.
@defvar treesit-thing-settings
This is an alist of thing definitions for each language. The key of
@ -1564,7 +1564,7 @@ list. For example, @w{@code{(or sexp sentence)}} defines something
that's either a @code{sexp} thing or a @code{sentence} thing, as defined
by some other rule in the alist.
Here's an example @var{treesit-thing-settings} for C and C++:
Here's an example @code{treesit-thing-settings} for C and C++:
@example
@group
@ -1624,7 +1624,7 @@ A positive @var{arg} means moving forward that many instances of
@code{end}, stop at the end of @var{thing}.
Like in @code{treesit-thing-prev}, @var{thing} can be a thing symbol
defined in @var{treesit-thing-settings}, or a thing definition.
defined in @code{treesit-thing-settings}, or a thing definition.
@var{tactic} determines how this function moves between things. It can
be @code{nested}, @code{top-level}, @code{restricted}, or @code{nil}.
@ -1651,7 +1651,7 @@ i.e., start position must be strictly greater than @var{position}, and end
position must be strictly less than @var{position}.
@var{thing} can be either a thing symbol defined in
@var{treesit-thing-settings}, or a thing definition.
@code{treesit-thing-settings}, or a thing definition.
@end defun
@findex treesit-beginning-of-thing
@ -1663,11 +1663,12 @@ thing, @code{treesit-end-of-thing} moves to the end of a thing, and
@code{treesit-thing-at-point} returns the thing at point.
There are also defun commands that specifically use the @code{defun}
definition (as a fallback of @var{treesit-defun-type-regexp}), like
definition (as a fallback of @code{treesit-defun-type-regexp}), like
@code{treesit-beginning-of-defun}, @code{treesit-end-of-defun}, and
@code{treesit-defun-at-point}. In addition, these functions use
@var{treesit-defun-tactic} as the navigation tactic. They are described
in more detail in other sections (@pxref{Tree-sitter Major Modes}).
@code{treesit-defun-tactic} as the navigation tactic. They are
described in more detail in other sections (@pxref{Tree-sitter Major
Modes}).
@node Multiple Languages
@section Parsing Text in Multiple Languages
@ -1692,23 +1693,22 @@ of the buffer. The parse tree of the primary parser is usually used to
determine the ranges in which the embedded parsers operate.
@vindex treesit-primary-parser
Major modes should set @var{treesit-primary-parser} to the primary
Major modes should set @code{treesit-primary-parser} to the primary
parser before calling @code{treesit-major-mode-setup}, so that Emacs can
configure the primary parser correctly for font-lock and other features.
Lisp programs should call @code{treesit-update-ranges} to make sure
the ranges for each parser are correct before using parsers in a
buffer, and call @code{treesit-language-at} to figure out the language
responsible for the text at some position. These two functions don't
work by themselves, they need major modes to set
@var{treesit-range-settings} and
@var{treesit-language-at-point-function}, which do the actual work.
Lisp programs should call @code{treesit-update-ranges} to make sure the
ranges for each parser are correct before using parsers in a buffer, and
call @code{treesit-language-at} to figure out the language responsible
for the text at some position. These two functions don't work by
themselves; they need major modes to set @code{treesit-range-settings}
and @code{treesit-language-at-point-function}, which do the actual work.
These functions and variables are explained in more detail towards the
end of the section.
@b{In short}, multi-language major modes should set
@var{treesit-primary-parser}, @var{treesit-range-settings}, and
@var{treesit-language-at-point-function} before calling
In short, multi-language major modes should set
@code{treesit-primary-parser}, @code{treesit-range-settings}, and
@code{treesit-language-at-point-function} before calling
@code{treesit-major-mode-setup}.
@heading Getting and setting ranges