diff options
| author | Michael Albinus | 2024-02-12 13:21:53 +0100 |
|---|---|---|
| committer | Michael Albinus | 2024-02-12 13:21:53 +0100 |
| commit | df243f785d4ce23bf49e84c8517d673a66fa0089 (patch) | |
| tree | 63de30aed66858251105a51fe6bc509e547a7d8d | |
| parent | 17a395e04c62d6c6c3f3ff4c4889f03e427e00d3 (diff) | |
| parent | 614b244a7fa03fcb27d76757e14ef0fa895d6f23 (diff) | |
| download | emacs-df243f785d4ce23bf49e84c8517d673a66fa0089.tar.gz emacs-df243f785d4ce23bf49e84c8517d673a66fa0089.zip | |
Merge branch 'emacs-29' of git.sv.gnu.org:/srv/git/emacs into emacs-29
| -rw-r--r-- | lisp/emacs-lisp/comp-cstr.el | 2 | ||||
| -rw-r--r-- | lisp/outline.el | 4 | ||||
| -rw-r--r-- | lisp/progmodes/typescript-ts-mode.el | 362 |
3 files changed, 192 insertions, 176 deletions
diff --git a/lisp/emacs-lisp/comp-cstr.el b/lisp/emacs-lisp/comp-cstr.el index 812a79f070d..ecbe6e38a1d 100644 --- a/lisp/emacs-lisp/comp-cstr.el +++ b/lisp/emacs-lisp/comp-cstr.el | |||
| @@ -203,6 +203,8 @@ Return them as multiple value." | |||
| 203 | t) | 203 | t) |
| 204 | ((and (not (symbolp x)) (symbolp y)) | 204 | ((and (not (symbolp x)) (symbolp y)) |
| 205 | nil) | 205 | nil) |
| 206 | ((or (consp x) (consp y) | ||
| 207 | nil)) | ||
| 206 | (t | 208 | (t |
| 207 | (< (sxhash-equal x) | 209 | (< (sxhash-equal x) |
| 208 | (sxhash-equal y))))))) | 210 | (sxhash-equal y))))))) |
diff --git a/lisp/outline.el b/lisp/outline.el index 96e0d0df205..724263ef3d2 100644 --- a/lisp/outline.el +++ b/lisp/outline.el | |||
| @@ -318,8 +318,8 @@ Using the value `insert' is not recommended in editable | |||
| 318 | buffers because it modifies them. | 318 | buffers because it modifies them. |
| 319 | When the value is `in-margins', then clickable buttons are | 319 | When the value is `in-margins', then clickable buttons are |
| 320 | displayed in the margins before the headings. | 320 | displayed in the margins before the headings. |
| 321 | When the value is `t', clickable buttons are displayed | 321 | When the value is t, clickable buttons are displayed |
| 322 | in the buffer before the headings. The values `t' and | 322 | in the buffer before the headings. The values t and |
| 323 | `in-margins' can be used in editing buffers because they | 323 | `in-margins' can be used in editing buffers because they |
| 324 | don't modify the buffer." | 324 | don't modify the buffer." |
| 325 | ;; The value `insert' is not intended to be customizable. | 325 | ;; The value `insert' is not intended to be customizable. |
diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index 89ca47571eb..7021f012dcd 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el | |||
| @@ -199,183 +199,197 @@ Argument LANGUAGE is either `typescript' or `tsx'." | |||
| 199 | [(nested_identifier (identifier)) (identifier)] | 199 | [(nested_identifier (identifier)) (identifier)] |
| 200 | @typescript-ts-jsx-tag-face))))) | 200 | @typescript-ts-jsx-tag-face))))) |
| 201 | 201 | ||
| 202 | (defun tsx-ts-mode--font-lock-compatibility-function-expression (language) | ||
| 203 | "Handle tree-sitter grammar breaking change for `function' expression. | ||
| 204 | |||
| 205 | LANGUAGE can be `typescript' or `tsx'. Starting from version 0.20.4 of the | ||
| 206 | typescript/tsx grammar, `function' becomes `function_expression'." | ||
| 207 | (condition-case nil | ||
| 208 | (progn (treesit-query-capture language '((function_expression) @cap)) | ||
| 209 | ;; New version of the grammar | ||
| 210 | 'function_expression) | ||
| 211 | (treesit-query-error | ||
| 212 | ;; Old version of the grammar | ||
| 213 | 'function))) | ||
| 214 | |||
| 202 | (defun typescript-ts-mode--font-lock-settings (language) | 215 | (defun typescript-ts-mode--font-lock-settings (language) |
| 203 | "Tree-sitter font-lock settings. | 216 | "Tree-sitter font-lock settings. |
| 204 | Argument LANGUAGE is either `typescript' or `tsx'." | 217 | Argument LANGUAGE is either `typescript' or `tsx'." |
| 205 | (treesit-font-lock-rules | 218 | (let ((func-exp (tsx-ts-mode--font-lock-compatibility-function-expression language))) |
| 206 | :language language | 219 | (treesit-font-lock-rules |
| 207 | :feature 'comment | 220 | :language language |
| 208 | `([(comment) (hash_bang_line)] @font-lock-comment-face) | 221 | :feature 'comment |
| 209 | 222 | `([(comment) (hash_bang_line)] @font-lock-comment-face) | |
| 210 | :language language | 223 | |
| 211 | :feature 'constant | 224 | :language language |
| 212 | `(((identifier) @font-lock-constant-face | 225 | :feature 'constant |
| 213 | (:match "\\`[A-Z_][0-9A-Z_]*\\'" @font-lock-constant-face)) | 226 | `(((identifier) @font-lock-constant-face |
| 214 | [(true) (false) (null)] @font-lock-constant-face) | 227 | (:match "\\`[A-Z_][0-9A-Z_]*\\'" @font-lock-constant-face)) |
| 215 | 228 | [(true) (false) (null)] @font-lock-constant-face) | |
| 216 | :language language | 229 | |
| 217 | :feature 'keyword | 230 | :language language |
| 218 | `([,@typescript-ts-mode--keywords] @font-lock-keyword-face | 231 | :feature 'keyword |
| 219 | [(this) (super)] @font-lock-keyword-face) | 232 | `([,@typescript-ts-mode--keywords] @font-lock-keyword-face |
| 220 | 233 | [(this) (super)] @font-lock-keyword-face) | |
| 221 | :language language | 234 | |
| 222 | :feature 'string | 235 | :language language |
| 223 | `((regex pattern: (regex_pattern)) @font-lock-regexp-face | 236 | :feature 'string |
| 224 | (string) @font-lock-string-face | 237 | `((regex pattern: (regex_pattern)) @font-lock-regexp-face |
| 225 | (template_string) @js--fontify-template-string | 238 | (string) @font-lock-string-face |
| 226 | (template_substitution ["${" "}"] @font-lock-misc-punctuation-face)) | 239 | (template_string) @js--fontify-template-string |
| 227 | 240 | (template_substitution ["${" "}"] @font-lock-misc-punctuation-face)) | |
| 228 | :language language | 241 | |
| 229 | :override t ;; for functions assigned to variables | 242 | :language language |
| 230 | :feature 'declaration | 243 | :override t ;; for functions assigned to variables |
| 231 | `((function | 244 | :feature 'declaration |
| 232 | name: (identifier) @font-lock-function-name-face) | 245 | `((,func-exp |
| 233 | (function_declaration | 246 | name: (identifier) @font-lock-function-name-face) |
| 234 | name: (identifier) @font-lock-function-name-face) | 247 | (function_declaration |
| 235 | (function_signature | 248 | name: (identifier) @font-lock-function-name-face) |
| 236 | name: (identifier) @font-lock-function-name-face) | 249 | (function_signature |
| 237 | 250 | name: (identifier) @font-lock-function-name-face) | |
| 238 | (method_definition | 251 | |
| 239 | name: (property_identifier) @font-lock-function-name-face) | 252 | (method_definition |
| 240 | (method_signature | 253 | name: (property_identifier) @font-lock-function-name-face) |
| 241 | name: (property_identifier) @font-lock-function-name-face) | 254 | (method_signature |
| 242 | (required_parameter (identifier) @font-lock-variable-name-face) | 255 | name: (property_identifier) @font-lock-function-name-face) |
| 243 | (optional_parameter (identifier) @font-lock-variable-name-face) | 256 | (required_parameter (identifier) @font-lock-variable-name-face) |
| 244 | 257 | (optional_parameter (identifier) @font-lock-variable-name-face) | |
| 245 | (variable_declarator | 258 | |
| 246 | name: (identifier) @font-lock-function-name-face | 259 | (variable_declarator |
| 247 | value: [(function) (arrow_function)]) | 260 | name: (identifier) @font-lock-function-name-face |
| 248 | 261 | value: [(,func-exp) (arrow_function)]) | |
| 249 | (variable_declarator | 262 | |
| 250 | name: (identifier) @font-lock-variable-name-face) | 263 | (variable_declarator |
| 251 | 264 | name: (identifier) @font-lock-variable-name-face) | |
| 252 | (enum_declaration (identifier) @font-lock-type-face) | 265 | |
| 253 | 266 | (enum_declaration (identifier) @font-lock-type-face) | |
| 254 | (extends_clause value: (identifier) @font-lock-type-face) | 267 | |
| 255 | ;; extends React.Component<T> | 268 | (extends_clause value: (identifier) @font-lock-type-face) |
| 256 | (extends_clause value: (member_expression | 269 | ;; extends React.Component<T> |
| 257 | object: (identifier) @font-lock-type-face | 270 | (extends_clause value: (member_expression |
| 258 | property: (property_identifier) @font-lock-type-face)) | 271 | object: (identifier) @font-lock-type-face |
| 259 | 272 | property: (property_identifier) @font-lock-type-face)) | |
| 260 | (arrow_function | 273 | |
| 261 | parameter: (identifier) @font-lock-variable-name-face) | 274 | (arrow_function |
| 262 | 275 | parameter: (identifier) @font-lock-variable-name-face) | |
| 263 | (variable_declarator | 276 | |
| 264 | name: (array_pattern | 277 | (variable_declarator |
| 265 | (identifier) | 278 | name: (array_pattern |
| 266 | (identifier) @font-lock-function-name-face) | 279 | (identifier) |
| 267 | value: (array (number) (function))) | 280 | (identifier) @font-lock-function-name-face) |
| 268 | 281 | value: (array (number) (,func-exp))) | |
| 269 | (catch_clause | 282 | |
| 270 | parameter: (identifier) @font-lock-variable-name-face) | 283 | (catch_clause |
| 271 | 284 | parameter: (identifier) @font-lock-variable-name-face) | |
| 272 | ;; full module imports | 285 | |
| 273 | (import_clause (identifier) @font-lock-variable-name-face) | 286 | ;; full module imports |
| 274 | ;; named imports with aliasing | 287 | (import_clause (identifier) @font-lock-variable-name-face) |
| 275 | (import_clause (named_imports (import_specifier | 288 | ;; named imports with aliasing |
| 276 | alias: (identifier) @font-lock-variable-name-face))) | 289 | (import_clause (named_imports (import_specifier |
| 277 | ;; named imports without aliasing | 290 | alias: (identifier) @font-lock-variable-name-face))) |
| 278 | (import_clause (named_imports (import_specifier | 291 | ;; named imports without aliasing |
| 279 | !alias | 292 | (import_clause (named_imports (import_specifier |
| 280 | name: (identifier) @font-lock-variable-name-face))) | 293 | !alias |
| 281 | 294 | name: (identifier) @font-lock-variable-name-face))) | |
| 282 | ;; full namespace import (* as alias) | 295 | |
| 283 | (import_clause (namespace_import (identifier) @font-lock-variable-name-face))) | 296 | ;; full namespace import (* as alias) |
| 284 | 297 | (import_clause (namespace_import (identifier) @font-lock-variable-name-face))) | |
| 285 | :language language | 298 | |
| 286 | :feature 'identifier | 299 | :language language |
| 287 | `((nested_type_identifier | 300 | :feature 'identifier |
| 288 | module: (identifier) @font-lock-type-face) | 301 | `((nested_type_identifier |
| 289 | 302 | module: (identifier) @font-lock-type-face) | |
| 290 | (type_identifier) @font-lock-type-face | 303 | |
| 291 | 304 | (type_identifier) @font-lock-type-face | |
| 292 | (predefined_type) @font-lock-type-face | 305 | |
| 293 | 306 | (predefined_type) @font-lock-type-face | |
| 294 | (new_expression | 307 | |
| 295 | constructor: (identifier) @font-lock-type-face) | 308 | (new_expression |
| 296 | 309 | constructor: (identifier) @font-lock-type-face) | |
| 297 | (enum_body (property_identifier) @font-lock-type-face) | 310 | |
| 298 | 311 | (enum_body (property_identifier) @font-lock-type-face) | |
| 299 | (enum_assignment name: (property_identifier) @font-lock-type-face) | 312 | |
| 300 | 313 | (enum_assignment name: (property_identifier) @font-lock-type-face) | |
| 301 | (variable_declarator | 314 | |
| 302 | name: (identifier) @font-lock-variable-name-face) | 315 | (variable_declarator |
| 303 | 316 | name: (identifier) @font-lock-variable-name-face) | |
| 304 | (for_in_statement | 317 | |
| 305 | left: (identifier) @font-lock-variable-name-face) | 318 | (for_in_statement |
| 306 | 319 | left: (identifier) @font-lock-variable-name-face) | |
| 307 | (arrow_function | 320 | |
| 308 | parameters: | 321 | (arrow_function |
| 309 | [(_ (identifier) @font-lock-variable-name-face) | 322 | parameters: |
| 310 | (_ (_ (identifier) @font-lock-variable-name-face)) | 323 | [(_ (identifier) @font-lock-variable-name-face) |
| 311 | (_ (_ (_ (identifier) @font-lock-variable-name-face)))])) | 324 | (_ (_ (identifier) @font-lock-variable-name-face)) |
| 312 | 325 | (_ (_ (_ (identifier) @font-lock-variable-name-face)))])) | |
| 313 | :language language | 326 | |
| 314 | :feature 'property | 327 | :language language |
| 315 | `((property_signature | 328 | :feature 'property |
| 316 | name: (property_identifier) @font-lock-property-name-face) | 329 | `((property_signature |
| 317 | (public_field_definition | 330 | name: (property_identifier) @font-lock-property-name-face) |
| 318 | name: (property_identifier) @font-lock-property-name-face) | 331 | (public_field_definition |
| 319 | 332 | name: (property_identifier) @font-lock-property-name-face) | |
| 320 | (pair key: (property_identifier) @font-lock-property-use-face) | 333 | |
| 321 | 334 | (pair key: (property_identifier) @font-lock-property-use-face) | |
| 322 | ((shorthand_property_identifier) @font-lock-property-use-face)) | 335 | |
| 323 | 336 | ((shorthand_property_identifier) @font-lock-property-use-face)) | |
| 324 | :language language | 337 | |
| 325 | :feature 'expression | 338 | :language language |
| 326 | '((assignment_expression | 339 | :feature 'expression |
| 327 | left: [(identifier) @font-lock-function-name-face | 340 | `((assignment_expression |
| 328 | (member_expression | 341 | left: [(identifier) @font-lock-function-name-face |
| 329 | property: (property_identifier) @font-lock-function-name-face)] | 342 | (member_expression |
| 330 | right: [(function) (arrow_function)])) | 343 | property: (property_identifier) @font-lock-function-name-face)] |
| 331 | 344 | right: [(,func-exp) (arrow_function)])) | |
| 332 | :language language | 345 | |
| 333 | :feature 'function | 346 | :language language |
| 334 | '((call_expression | 347 | :feature 'function |
| 335 | function: | 348 | '((call_expression |
| 336 | [(identifier) @font-lock-function-call-face | 349 | function: |
| 337 | (member_expression | 350 | [(identifier) @font-lock-function-call-face |
| 338 | property: (property_identifier) @font-lock-function-call-face)])) | 351 | (member_expression |
| 339 | 352 | property: (property_identifier) @font-lock-function-call-face)])) | |
| 340 | :language language | 353 | |
| 341 | :feature 'pattern | 354 | :language language |
| 342 | `((pair_pattern | 355 | :feature 'pattern |
| 343 | key: (property_identifier) @font-lock-property-use-face | 356 | `((pair_pattern |
| 344 | value: [(identifier) @font-lock-variable-name-face | 357 | key: (property_identifier) @font-lock-property-use-face |
| 345 | (assignment_pattern left: (identifier) @font-lock-variable-name-face)]) | 358 | value: [(identifier) @font-lock-variable-name-face |
| 346 | 359 | (assignment_pattern left: (identifier) @font-lock-variable-name-face)]) | |
| 347 | (array_pattern (identifier) @font-lock-variable-name-face) | 360 | |
| 348 | 361 | (array_pattern (identifier) @font-lock-variable-name-face) | |
| 349 | ((shorthand_property_identifier_pattern) @font-lock-variable-name-face)) | 362 | |
| 350 | 363 | ((shorthand_property_identifier_pattern) @font-lock-variable-name-face)) | |
| 351 | :language language | 364 | |
| 352 | :feature 'jsx | 365 | :language language |
| 353 | (append (tsx-ts-mode--font-lock-compatibility-bb1f97b language) | 366 | :feature 'jsx |
| 354 | `((jsx_attribute (property_identifier) @typescript-ts-jsx-attribute-face))) | 367 | (append (tsx-ts-mode--font-lock-compatibility-bb1f97b language) |
| 355 | 368 | `((jsx_attribute (property_identifier) @typescript-ts-jsx-attribute-face))) | |
| 356 | :language language | 369 | |
| 357 | :feature 'number | 370 | :language language |
| 358 | `((number) @font-lock-number-face | 371 | :feature 'number |
| 359 | ((identifier) @font-lock-number-face | 372 | `((number) @font-lock-number-face |
| 360 | (:match "\\`\\(?:NaN\\|Infinity\\)\\'" @font-lock-number-face))) | 373 | ((identifier) @font-lock-number-face |
| 361 | 374 | (:match "\\`\\(?:NaN\\|Infinity\\)\\'" @font-lock-number-face))) | |
| 362 | :language language | 375 | |
| 363 | :feature 'operator | 376 | :language language |
| 364 | `([,@typescript-ts-mode--operators] @font-lock-operator-face | 377 | :feature 'operator |
| 365 | (ternary_expression ["?" ":"] @font-lock-operator-face)) | 378 | `([,@typescript-ts-mode--operators] @font-lock-operator-face |
| 366 | 379 | (ternary_expression ["?" ":"] @font-lock-operator-face)) | |
| 367 | :language language | 380 | |
| 368 | :feature 'bracket | 381 | :language language |
| 369 | '((["(" ")" "[" "]" "{" "}"]) @font-lock-bracket-face) | 382 | :feature 'bracket |
| 370 | 383 | '((["(" ")" "[" "]" "{" "}"]) @font-lock-bracket-face) | |
| 371 | :language language | 384 | |
| 372 | :feature 'delimiter | 385 | :language language |
| 373 | '((["," "." ";" ":"]) @font-lock-delimiter-face) | 386 | :feature 'delimiter |
| 374 | 387 | '((["," "." ";" ":"]) @font-lock-delimiter-face) | |
| 375 | :language language | 388 | |
| 376 | :feature 'escape-sequence | 389 | :language language |
| 377 | :override t | 390 | :feature 'escape-sequence |
| 378 | '((escape_sequence) @font-lock-escape-face))) | 391 | :override t |
| 392 | '((escape_sequence) @font-lock-escape-face)))) | ||
| 379 | 393 | ||
| 380 | ;;;###autoload | 394 | ;;;###autoload |
| 381 | (define-derived-mode typescript-ts-base-mode prog-mode "TypeScript" | 395 | (define-derived-mode typescript-ts-base-mode prog-mode "TypeScript" |