summaryrefslogtreecommitdiff
path: root/doc/lispref/modes.texi
diff options
context:
space:
mode:
authorYuan Fu <casouri@gmail.com>2022-11-02 17:03:03 -0700
committerYuan Fu <casouri@gmail.com>2022-11-02 17:03:03 -0700
commit69ab588bb54178df0d3be6b4c04dabb49f5a2ac9 (patch)
treea308a378f3efb1f742fec67cd807bc394689bd0b /doc/lispref/modes.texi
parentf331be1f074d68e7e5cdbac324419e07c186492a (diff)
downloademacs-69ab588bb54178df0d3be6b4c04dabb49f5a2ac9.tar.gz
Pass region start and end to tree-sitter fontification functions
* doc/lispref/modes.texi (Parser-based Font Lock): Update manual. * lisp/progmodes/js.el (js--fontify-template-string) * lisp/progmodes/python.el (python--treesit-fontify-string): Update function to only fontify within the region. * lisp/treesit.el (treesit-font-lock-rules): Update docstring. (treesit-font-lock-fontify-region): Pass START and END to fontification functions.
Diffstat (limited to 'doc/lispref/modes.texi')
-rw-r--r--doc/lispref/modes.texi16
1 files changed, 9 insertions, 7 deletions
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi
index c6f848ffb23..c1b092247bd 100644
--- a/doc/lispref/modes.texi
+++ b/doc/lispref/modes.texi
@@ -3979,13 +3979,15 @@ with that face.
@findex treesit-fontify-with-override
Capture names can also be function names, in which case the function
-is called with 2 arguments: @var{node} and @var{override}, where
-@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 2 arguments
-presented, this function should accept more arguments as optional
-arguments for future extensibility.
+is called with 4 arguments: @var{node} and @var{override}, @var{start}
+and @var{end}, where @var{node} is the node itself, @var{override} is
+the override property of the rule which captured this node, and
+@var{start} and @var{end} limits the region in which this function
+should fontify. (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