Merge from origin/emacs-29

a9b28224af ; Last-minute changes befor releasing 29.1
7da1cee56b Update CMake support due to upstream changes (bug#64922)
c2d95dd00e Remove nullptr named node from c++-ts-mode (bug#64818)
4e977136d3 Make compat check also check typescript
906ecf442c ; * etc/HISTORY: Fix the 28.3 entry.
This commit is contained in:
Eli Zaretskii 2023-07-31 11:11:23 -04:00
commit 70421a8819
5 changed files with 90 additions and 25 deletions

View file

@ -1,7 +1,49 @@
2023-07-29 Eli Zaretskii <eliz@maintain0p.gnu.org>
2023-07-30 Eli Zaretskii <eliz@maintain0p.gnu.org>
* Version 29.1 released.
2023-07-29 Vincenzo Pupillo <v.pupillo@gmail.com>
Update CMake support due to upstream changes (bug#64922)
A recent change in tree-sitter-cmake grammar support for CMake (commit
fe9b5e0), now put arguments are wrapped in a new argument_list node.
To support the old and new version of the grammar, a new function was
added on which string syntax highlighting now depends.
* lisp/progmodes/cmake-ts-mode.el
(cmake-ts-mode--font-lock-compatibility-fe9b5e0): Indent helper
function to handle different tree-sitter-cmake version.
* lisp/progmodes/cmake-ts-mode.el
(cmake-ts-mode--font-lock-settings): Use the new function to handle
the new argument_list node.
2023-07-24 Theodor Thornhill <theo@thornhill.no>
Remove nullptr named node from c++-ts-mode (bug#64818)
The nullptr node was changed from a named node to an unnamed node
upstream[0], which caused font locking to break. As this is a small
enough regression, no compat code is required.
* lisp/progmodes/c-ts-mode.el (c-ts-mode--font-lock-settings): Remove
node no longer in use.
[0]:
https://github.com/tree-sitter/tree-sitter-c/commit/c75868f8b508ae32a0c8490da91bb31b2b96430e
2023-07-24 Theodor Thornhill <theo@thornhill.no>
Make compat check also check typescript
* lisp/progmodes/typescript-ts-mode.el
(tsx-ts-mode--font-lock-compatibility-bb1f97b):
Add argument so that we run the 'treesit-query-capture' when the
language is 'typescript', not only 'tsx'.
* lisp/progmodes/typescript-ts-mode.el
(typescript-ts-mode--font-lock-settings): Use supplied argument.
2023-07-23 Eli Zaretskii <eliz@gnu.org>
Bump Emacs version
@ -117338,7 +117380,7 @@
This file records repository revisions from
commit f2ae39829812098d8269eafbc0fcb98959ee5bb7 (exclusive) to
commit 76a142e265df742b2fdd3d220607a46fcbc30e1a (inclusive).
commit 7d1737071fba1fd83039aac34f34f6b90c9579b8 (inclusive).
See ChangeLog.3 for earlier changes.
;; Local Variables:

View file

@ -228,9 +228,9 @@ GNU Emacs 28.1 (2022-04-04) emacs-28.1
GNU Emacs 28.2 (2022-09-12) emacs-28.2
GNU Emacs 28.3 (2023-02-17) emacs-28.3
GNU Emacs 28.3 (2023-02-17) emacs-28.3 (was not actually released)
GNU Emacs 29.1 (2023-07-29) emacs-29.1
GNU Emacs 29.1 (2023-07-30) emacs-29.1
----------------------------------------------------------------------

View file

@ -574,9 +574,7 @@ MODE is either `c' or `cpp'."
:feature 'constant
`((true) @font-lock-constant-face
(false) @font-lock-constant-face
(null) @font-lock-constant-face
,@(when (eq mode 'cpp)
'((nullptr) @font-lock-constant-face)))
(null) @font-lock-constant-face)
:language mode
:feature 'keyword

View file

@ -31,6 +31,7 @@
(eval-when-compile (require 'rx))
(declare-function treesit-parser-create "treesit.c")
(declare-function treesit-query-capture "treesit.c")
(declare-function treesit-induce-sparse-tree "treesit.c")
(declare-function treesit-node-child "treesit.c")
(declare-function treesit-node-start "treesit.c")
@ -87,6 +88,42 @@
"VERSION_GREATER_EQUAL" "VERSION_LESS" "VERSION_LESS_EQUAL")
"CMake if conditions for tree-sitter font-locking.")
(defun cmake-ts-mode--font-lock-compatibility-fe9b5e0 ()
"Indent rules helper, to handle different releases of tree-sitter-cmake.
Check if a node type is available, then return the right indent rules."
;; handle commit fe9b5e0
(condition-case nil
(progn (treesit-query-capture 'cmake '((argument_list) @capture))
`(((foreach_command
((argument_list) @font-lock-constant-face
(:match ,(rx-to-string
`(seq bol
(or ,@cmake-ts-mode--foreach-options)
eol))
@font-lock-constant-face))))
((if_command
((argument_list) @font-lock-constant-face
(:match ,(rx-to-string
`(seq bol
(or ,@cmake-ts-mode--if-conditions)
eol))
@font-lock-constant-face))))))
(error
`(((foreach_command
((argument) @font-lock-constant-face
(:match ,(rx-to-string
`(seq bol
(or ,@cmake-ts-mode--foreach-options)
eol))
@font-lock-constant-face))))
((if_command
((argument) @font-lock-constant-face
(:match ,(rx-to-string
`(seq bol
(or ,@cmake-ts-mode--if-conditions)
eol))
@font-lock-constant-face))))))))
(defvar cmake-ts-mode--font-lock-settings
(treesit-font-lock-rules
:language 'cmake
@ -95,20 +132,7 @@
:language 'cmake
:feature 'builtin
`(((foreach_command
((argument) @font-lock-constant-face
(:match ,(rx-to-string
`(seq bol
(or ,@cmake-ts-mode--foreach-options)
eol))
@font-lock-constant-face))))
((if_command
((argument) @font-lock-constant-face
(:match ,(rx-to-string
`(seq bol
(or ,@cmake-ts-mode--if-conditions)
eol))
@font-lock-constant-face)))))
(cmake-ts-mode--font-lock-compatibility-fe9b5e0)
:language 'cmake
:feature 'comment

View file

@ -154,15 +154,16 @@ Argument LANGUAGE is either `typescript' or `tsx'."
"&&" "||" "!" "?.")
"TypeScript operators for tree-sitter font-locking.")
(defun tsx-ts-mode--font-lock-compatibility-bb1f97b ()
(defun tsx-ts-mode--font-lock-compatibility-bb1f97b (language)
"Font lock rules helper, to handle different releases of tree-sitter-tsx.
Check if a node type is available, then return the right font lock rules."
Check if a node type is available, then return the right font lock rules.
Argument LANGUAGE is either `typescript' or `tsx'."
;; handle commit bb1f97b
;; Warning: treesitter-query-capture says both node types are valid,
;; but then raises an error if the wrong node type is used. So it is
;; important to check with the new node type (member_expression)
(condition-case nil
(progn (treesit-query-capture 'tsx '((member_expression) @capture))
(progn (treesit-query-capture language '((member_expression) @capture))
'((jsx_opening_element
[(member_expression (identifier)) (identifier)]
@typescript-ts-jsx-tag-face)
@ -337,7 +338,7 @@ Argument LANGUAGE is either `typescript' or `tsx'."
:language language
:feature 'jsx
(append (tsx-ts-mode--font-lock-compatibility-bb1f97b)
(append (tsx-ts-mode--font-lock-compatibility-bb1f97b language)
`((jsx_attribute (property_identifier) @typescript-ts-jsx-attribute-face)))
:language language