Merge branch 'emacs-29' of git.sv.gnu.org:/srv/git/emacs into emacs-29

This commit is contained in:
Michael Albinus 2024-02-12 13:21:53 +01:00
commit df243f785d
3 changed files with 155 additions and 139 deletions

View file

@ -203,6 +203,8 @@ Return them as multiple value."
t) t)
((and (not (symbolp x)) (symbolp y)) ((and (not (symbolp x)) (symbolp y))
nil) nil)
((or (consp x) (consp y)
nil))
(t (t
(< (sxhash-equal x) (< (sxhash-equal x)
(sxhash-equal y))))))) (sxhash-equal y)))))))

View file

@ -318,8 +318,8 @@ Using the value `insert' is not recommended in editable
buffers because it modifies them. buffers because it modifies them.
When the value is `in-margins', then clickable buttons are When the value is `in-margins', then clickable buttons are
displayed in the margins before the headings. displayed in the margins before the headings.
When the value is `t', clickable buttons are displayed When the value is t, clickable buttons are displayed
in the buffer before the headings. The values `t' and in the buffer before the headings. The values t and
`in-margins' can be used in editing buffers because they `in-margins' can be used in editing buffers because they
don't modify the buffer." don't modify the buffer."
;; The value `insert' is not intended to be customizable. ;; The value `insert' is not intended to be customizable.

View file

@ -199,9 +199,23 @@ Argument LANGUAGE is either `typescript' or `tsx'."
[(nested_identifier (identifier)) (identifier)] [(nested_identifier (identifier)) (identifier)]
@typescript-ts-jsx-tag-face))))) @typescript-ts-jsx-tag-face)))))
(defun tsx-ts-mode--font-lock-compatibility-function-expression (language)
"Handle tree-sitter grammar breaking change for `function' expression.
LANGUAGE can be `typescript' or `tsx'. Starting from version 0.20.4 of the
typescript/tsx grammar, `function' becomes `function_expression'."
(condition-case nil
(progn (treesit-query-capture language '((function_expression) @cap))
;; New version of the grammar
'function_expression)
(treesit-query-error
;; Old version of the grammar
'function)))
(defun typescript-ts-mode--font-lock-settings (language) (defun typescript-ts-mode--font-lock-settings (language)
"Tree-sitter font-lock settings. "Tree-sitter font-lock settings.
Argument LANGUAGE is either `typescript' or `tsx'." Argument LANGUAGE is either `typescript' or `tsx'."
(let ((func-exp (tsx-ts-mode--font-lock-compatibility-function-expression language)))
(treesit-font-lock-rules (treesit-font-lock-rules
:language language :language language
:feature 'comment :feature 'comment
@ -228,7 +242,7 @@ Argument LANGUAGE is either `typescript' or `tsx'."
:language language :language language
:override t ;; for functions assigned to variables :override t ;; for functions assigned to variables
:feature 'declaration :feature 'declaration
`((function `((,func-exp
name: (identifier) @font-lock-function-name-face) name: (identifier) @font-lock-function-name-face)
(function_declaration (function_declaration
name: (identifier) @font-lock-function-name-face) name: (identifier) @font-lock-function-name-face)
@ -244,7 +258,7 @@ Argument LANGUAGE is either `typescript' or `tsx'."
(variable_declarator (variable_declarator
name: (identifier) @font-lock-function-name-face name: (identifier) @font-lock-function-name-face
value: [(function) (arrow_function)]) value: [(,func-exp) (arrow_function)])
(variable_declarator (variable_declarator
name: (identifier) @font-lock-variable-name-face) name: (identifier) @font-lock-variable-name-face)
@ -264,7 +278,7 @@ Argument LANGUAGE is either `typescript' or `tsx'."
name: (array_pattern name: (array_pattern
(identifier) (identifier)
(identifier) @font-lock-function-name-face) (identifier) @font-lock-function-name-face)
value: (array (number) (function))) value: (array (number) (,func-exp)))
(catch_clause (catch_clause
parameter: (identifier) @font-lock-variable-name-face) parameter: (identifier) @font-lock-variable-name-face)
@ -323,11 +337,11 @@ Argument LANGUAGE is either `typescript' or `tsx'."
:language language :language language
:feature 'expression :feature 'expression
'((assignment_expression `((assignment_expression
left: [(identifier) @font-lock-function-name-face left: [(identifier) @font-lock-function-name-face
(member_expression (member_expression
property: (property_identifier) @font-lock-function-name-face)] property: (property_identifier) @font-lock-function-name-face)]
right: [(function) (arrow_function)])) right: [(,func-exp) (arrow_function)]))
:language language :language language
:feature 'function :feature 'function
@ -375,7 +389,7 @@ Argument LANGUAGE is either `typescript' or `tsx'."
:language language :language language
:feature 'escape-sequence :feature 'escape-sequence
:override t :override t
'((escape_sequence) @font-lock-escape-face))) '((escape_sequence) @font-lock-escape-face))))
;;;###autoload ;;;###autoload
(define-derived-mode typescript-ts-base-mode prog-mode "TypeScript" (define-derived-mode typescript-ts-base-mode prog-mode "TypeScript"