diff options
author | Yuan Fu <casouri@gmail.com> | 2022-10-04 13:28:46 -0700 |
---|---|---|
committer | Yuan Fu <casouri@gmail.com> | 2022-10-04 13:30:56 -0700 |
commit | 23bb724c922de95573f73b22ae311696ae08464e (patch) | |
tree | c1c219dd9515d10f6ac42d7e4771345bfc8a22c0 /doc/lispref/modes.texi | |
parent | 7a4380b9051ddd0bcc4d5c90abe0f826a9b922dc (diff) | |
download | emacs-23bb724c922de95573f73b22ae311696ae08464e.tar.gz emacs-23bb724c922de95573f73b22ae311696ae08464e.tar.bz2 emacs-23bb724c922de95573f73b22ae311696ae08464e.zip |
Add :override flag for tree-sitter font-lock
* doc/lispref/modes.texi (Parser-based Font Lock): Update manual.
* lisp/treesit.el (treesit-font-lock-settings): Update docstring.
(treesit-font-lock-rules): Handle :override.
(treesit-font-lock-fontify-region): Handle :override. Also set
inhibit-point-motion-hooks to t.
Diffstat (limited to 'doc/lispref/modes.texi')
-rw-r--r-- | doc/lispref/modes.texi | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index 0d58c28e271..883f9d8491f 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -3911,6 +3911,7 @@ a value that @var{treesit-font-lock-settings} accepts. An example: @group (treesit-font-lock-rules :language 'javascript + :override t '((true) @@font-lock-constant-face (false) @@font-lock-constant-face) :language 'html @@ -3919,9 +3920,19 @@ a value that @var{treesit-font-lock-settings} accepts. An example: @end example This function takes a list of text or s-exp queries. Before each -query, there are @var{:keyword} and @var{value} pairs that configures -that query. The @code{:lang} keyword sets the query’s language, and is -currently the only recognized keyword. +query, there are @var{:keyword} and @var{value} pairs that configure +that query. The @code{:lang} keyword sets the query’s language and +every query must specify the language. Other keywords are optional: + +@multitable @columnfractions .15 .15 .6 +@headitem Keyword @tab Value @tab Description +@item @code{:override} @tab nil +@tab If the region already has a face, discard the new face +@item @tab t @tab Always apply the new face +@item @tab @code{append} @tab Append the new face to existing ones +@item @tab @code{prepend} @tab Prepend the new face to existing ones +@item @tab @code{keep} @tab Fill-in regions without an existing face +@end multitable Capture names in @var{query} should be face names like @code{font-lock-keyword-face}. The captured node will be fontified |