summaryrefslogtreecommitdiff
path: root/doc/lispref/modes.texi
diff options
context:
space:
mode:
authorYuan Fu <casouri@gmail.com>2022-12-18 14:11:54 -0800
committerYuan Fu <casouri@gmail.com>2022-12-18 14:48:38 -0800
commitce7b7e5af3ddb2863c0c4f6f7c91d1b6c205f1a0 (patch)
tree4cc3624341851c2660400a5c3aa689e29280d354 /doc/lispref/modes.texi
parentc1e015ae320c7ea0f9ca764b2df5fcd6f0d39994 (diff)
downloademacs-ce7b7e5af3ddb2863c0c4f6f7c91d1b6c205f1a0.tar.gz
Remove comment-start-skip preset in tree-sitter indentation engine
Comment indentation should use a adaptive-fill-based indent, rather than comment-start-skip. Also remove manual description of removed variables in treesit.el and add documentation for n-p-gp upon request. * doc/lispref/modes.texi (Parser-based Indentation) * lisp/treesit.el (treesit-simple-indent-presets): Add n-p-gp, remove treesit-comment-start/end, remove comment-start-skip. * doc/lispref/parsing.texi (Tree-sitter major modes): Remove treesit-comment-start/end.
Diffstat (limited to 'doc/lispref/modes.texi')
-rw-r--r--doc/lispref/modes.texi28
1 files changed, 15 insertions, 13 deletions
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi
index 9ff9614a667..c44938f3929 100644
--- a/doc/lispref/modes.texi
+++ b/doc/lispref/modes.texi
@@ -4967,12 +4967,22 @@ first child where parent is @code{argument_list}, use
(match nil "argument_list" nil nil 0 0)
@end example
+@item n-p-gp
+Short for ``node-parent-grandparent'', this matcher is a function of 3
+arguments: @var{node-type}, @var{parent-type}, and
+@var{grandparent-type}. It returns a function that is called with 3
+arguments: @var{node}, @var{parent}, and @var{bol}, and returns
+non-@code{nil} if: (1) @var{node-type} matches @var{node}'s type, and
+(2) @var{parent-type} matches @var{parent}'s type, and (3)
+@var{grandparent-type} matches @var{parent}'s parent's type. If any
+of @var{node-type}, @var{parent-type}, and @var{grandparent-type} is
+@code{nil}, this function doesn't check for it.
+
@item comment-end
This matcher is a function that is called with 3 arguments:
@var{node}, @var{parent}, and @var{bol}, and returns non-@code{nil} if
point is before a comment ending token. Comment ending tokens are
-defined by regular expression @code{treesit-comment-end}
-(@pxref{Tree-sitter major modes, treesit-comment-end}).
+defined by regular expression @code{comment-end-skip}
@item first-sibling
This anchor is a function that is called with 3 arguments: @var{node},
@@ -5009,19 +5019,11 @@ This is useful as the beginning of the buffer is always at column 0.
@item comment-start
This anchor is a function that is called with 3 arguments: @var{node},
-@var{parent}, and @var{bol}, and returns the position right after the
+@var{parent}, and @var{bol}, and returns the position after the
comment-start token. Comment-start tokens are defined by regular
-expression @code{treesit-comment-start} (@pxref{Tree-sitter major
-modes, treesit-comment-start}). This function assumes @var{parent} is
-the comment node.
+expression @code{comment-start-skip}. This function assumes
+@var{parent} is the comment node.
-@item comment-start-skip
-This anchor is a function that is called with 3 arguments: @var{node},
-@var{parent}, and @var{bol}, and returns the position after the
-comment-start token and any whitespace characters following that
-token. Comment-start tokens are defined by regular expression
-@code{treesit-comment-start}. This function assumes @var{parent} is
-the comment node.
@end ftable
@end defvar