[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master aa6cb416617 1/2: Documentation for treesit-font-lock-rules change
From: |
Yuan Fu |
Subject: |
master aa6cb416617 1/2: Documentation for treesit-font-lock-rules change |
Date: |
Sat, 21 Oct 2023 14:34:32 -0400 (EDT) |
branch: master
commit aa6cb4166174d2b7d601bb3dc6c2f03b5296a442
Author: Yuan Fu <casouri@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>
Documentation for treesit-font-lock-rules change
* doc/lispref/modes.texi (Parser-based Font Lock): Update manual.
* lisp/treesit.el (treesit-font-lock-rules): Update docstring.
---
doc/lispref/modes.texi | 5 ++++-
etc/NEWS | 5 +++++
lisp/treesit.el | 2 ++
3 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi
index 00148420893..f365d88fade 100644
--- a/doc/lispref/modes.texi
+++ b/doc/lispref/modes.texi
@@ -4149,7 +4149,7 @@ it add meta information to it. The @code{:language}
keyword declares
name of @var{query}. Users can control which features are enabled
with @code{treesit-font-lock-level} and
@code{treesit-font-lock-feature-list} (described below). These two
-keywords are mandatory.
+keywords are mandatory (with exceptions).
Other keywords are optional:
@@ -4161,6 +4161,9 @@ Other keywords are optional:
@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
+@item @code{:default-language} @tab @var{language}
+@tab Every @var{query} after this keyword will use @var{language}
+by default.
@end multitable
Lisp programs mark patterns in @var{query} with capture names (names
diff --git a/etc/NEWS b/etc/NEWS
index 3810305e9f4..5d42d88fb60 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1353,6 +1353,11 @@ Since circular alias chains now cannot occur,
'function-alias-p',
'indirect-function' and 'indirect-variable' will never signal an error.
Their 'noerror' arguments have no effect and are therefore obsolete.
++++
+** 'treesit-font-lock-rules' now accepts additional global keywords.
+When supplied with ':default-language LANGUAGE', rules after it will
+default to use 'LANGUAGE'.
+
* Changes in Emacs 30.1 on Non-Free Operating Systems
diff --git a/lisp/treesit.el b/lisp/treesit.el
index 669f41d8015..80bdf164b07 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -892,6 +892,8 @@ Other keywords include:
`append' Append the new face to existing ones.
`prepend' Prepend the new face to existing ones.
`keep' Fill-in regions without an existing face.
+ :default-language LANGUAGE Every QUERY after this keyword
+ will use LANGUAGE by default.
Capture names in QUERY should be face names like
`font-lock-keyword-face'. The captured node will be fontified