summaryrefslogtreecommitdiff
path: root/doc/lispref/modes.texi
diff options
context:
space:
mode:
authorYuan Fu <casouri@gmail.com>2022-10-31 15:03:49 -0700
committerYuan Fu <casouri@gmail.com>2022-10-31 15:03:49 -0700
commiteeeae5e9ee34da5539046ff8dac4f4fffa19a5b9 (patch)
treeb815a383714dc3ee9d33c61fc39e91429709f344 /doc/lispref/modes.texi
parent9fab83ed7a90209e3873039e7ae4993c667e2759 (diff)
downloademacs-eeeae5e9ee34da5539046ff8dac4f4fffa19a5b9.tar.gz
Add an argument OVERRIDE to tree-sitter font-lock functions
* doc/lispref/modes.texi (Parser-based Font Lock): Reflect this change in manual. * lisp/progmodes/js.el (js--fontify-template-string): Add _OVERRIDE argument. * lisp/progmodes/python.el (python--treesit-fontify-string): Add _OVERRIDE argument. * lisp/treesit.el (treesit-font-lock-rules): Update docstring. (treesit-fontify-with-override): New function. (treesit-font-lock-fontify-region): Extract out into treesit-fontify-with-override.
Diffstat (limited to 'doc/lispref/modes.texi')
-rw-r--r--doc/lispref/modes.texi22
1 files changed, 16 insertions, 6 deletions
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi
index d778636d6d3..40d966ef17a 100644
--- a/doc/lispref/modes.texi
+++ b/doc/lispref/modes.texi
@@ -3975,12 +3975,22 @@ that starts with @code{@@}), and tree-sitter will return matched nodes
tagged with those same capture names. For the purpose of
fontification, capture names in @var{query} should be face names like
@code{font-lock-keyword-face}. The captured node will be fontified
-with that face. Capture names can also be function names, in which
-case the function is called with 3 arguments: @var{start}, @var{end},
-and @var{node}, where @var{start} and @var{end} are the start and end
-position of the node in buffer, and @var{node} is the node itself. If
-a capture name is both a face and a function, the face takes priority.
-If a capture name is neither a face nor a function, it is ignored.
+with that face.
+
+@findex treesit-fontify-with-override
+Capture names can also be function names, in which case the function
+is called with 4 arguments: @var{start}, @var{end}, @var{node}, and
+@var{override}, where @var{start} and @var{end} are the start and end
+position of the node in buffer, @var{node} is the node itself, and
+@var{override} is the override property of the rule which captured
+this node. (If this function wants to respect the @var{override}
+argument, it can use @code{treesit-fontify-with-override}.) Beyond
+the 4 arguments presented, this function should accept more arguments
+as optional arguments for future extensibility.
+
+If a capture name is both a face and a function, the face takes
+priority. If a capture name is neither a face nor a function, it is
+ignored.
@end defun
@defvar treesit-font-lock-feature-list