1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-02 08:22:22 +00:00

Merge from origin/emacs-29

9d410f8de6 (treesit-simple-indent-presets): Ensure 'and' works for a...
ff66a5d324 (treesit--indent-rules-optimize): Optimize 'and' and 'or'...
f2ebe43362 (treesit-simple-indent-presets): Short-circuit 'and' and ...
2ea6ee5cbf (font-lock-regexp-face): New face
5ab03bcc43 Unify the string interpolation delimiters face across ts ...
92e8c0c091 ruby-ts-mode: Highlight more kinds of parameters
7420b6dcc3 Fix `pr-interface'
699711786a Further generic-related improvements in csharp-ts-mode (b...

# Conflicts:
#	etc/NEWS
This commit is contained in:
Stefan Kangas 2023-01-07 06:30:10 +01:00
commit abeb29bfcc
9 changed files with 70 additions and 27 deletions

View File

@ -798,6 +798,7 @@ filter/sentinel error has been handled.
These faces are primarily meant for use with tree-sitter. They are:
'font-lock-bracket-face', 'font-lock-delimiter-face',
'font-lock-escape-face', 'font-lock-number-face',
'font-lock-regexp-face',
'font-lock-misc-punctuation-face', 'font-lock-operator-face',
'font-lock-property-face', and 'font-lock-punctuation-face'.

View File

@ -2073,6 +2073,12 @@ as the constructs of Haddock, Javadoc and similar systems."
"Font Lock mode face used to highlight preprocessor directives."
:group 'font-lock-faces)
(defface font-lock-regexp-face
'((t :inherit font-lock-string-face))
"Font Lock mode face used to highlight regexp literals."
:group 'font-lock-faces
:version "29.1")
(defface font-lock-regexp-grouping-backslash
'((t :inherit bold))
"Font Lock mode face for backslashes in Lisp regexp grouping constructs."

View File

@ -773,9 +773,12 @@ compilation and evaluation time conflicts."
(array_type
(identifier) @font-lock-type-face)
(cast_expression (identifier) @font-lock-type-face)
(cast_expression (generic_name (identifier) @font-lock-type-face))
["operator"] @font-lock-type-face
(type_parameter_constraints_clause
target: (identifier) @font-lock-type-face)
(type_constraint type: (identifier) @font-lock-type-face)
(type_constraint type: (generic_name (identifier) @font-lock-type-face))
(type_of_expression (identifier) @font-lock-type-face)
(object_creation_expression
type: (identifier) @font-lock-type-face)

View File

@ -3498,14 +3498,14 @@ This function is intended for use in `after-change-functions'."
:language 'javascript
:feature 'string
'((regex pattern: (regex_pattern)) @font-lock-string-face
'((regex pattern: (regex_pattern)) @font-lock-regexp-face
(string) @font-lock-string-face)
:language 'javascript
:feature 'string-interpolation
:override t
'((template_string) @js--fontify-template-string
(template_substitution ["${" "}"] @font-lock-delimiter-face))
(template_substitution ["${" "}"] @font-lock-misc-punctuation-face))
:language 'javascript
:feature 'definition

View File

@ -215,13 +215,6 @@ values of OVERRIDE"
(false) @font-lock-doc-markup-face
(nil) @font-lock-doc-markup-face)
:language language
:feature 'symbol
'((bare_symbol) @font-lock-constant-face
(delimited_symbol (string_content) @font-lock-constant-face)
(hash_key_symbol) @font-lock-constant-face
(simple_symbol) @font-lock-constant-face)
;; Before 'operator so (unary) works.
:language language
:feature 'literal
@ -234,10 +227,8 @@ values of OVERRIDE"
;; Also before 'operator because % and / are operators
:language language
:feature 'regexp
;; TODO: We probably need a separate face for regexps everywhere.
;; Maybe another one for regexp delimiters as well.
'((regex "/" @font-lock-string-face)
(regex _ (string_content) @font-lock-string-face))
'((regex "/" @font-lock-regexp-face)
(regex _ (string_content) @font-lock-regexp-face))
:language language
:feature 'operator
@ -266,8 +257,8 @@ values of OVERRIDE"
:language language
:feature 'interpolation
'((interpolation "#{" @font-lock-delimiter-face)
(interpolation "}" @font-lock-delimiter-face))
'((interpolation "#{" @font-lock-misc-punctuation-face)
(interpolation "}" @font-lock-misc-punctuation-face))
:language language
:feature 'type
@ -303,7 +294,19 @@ values of OVERRIDE"
(hash_splat_parameter
name: (identifier) @font-lock-variable-name-face)
(block_parameter
name: (identifier) @font-lock-variable-name-face))
name: (identifier) @font-lock-variable-name-face)
(destructured_parameter
(identifier) @font-lock-variable-name-face)
(lambda_parameters
(identifier) @font-lock-variable-name-face)
(exception_variable
(identifier) @font-lock-variable-name-face)
(array_pattern
(identifier) @font-lock-variable-name-face)
(keyword_pattern
key: (hash_key_symbol) @font-lock-variable-name-face)
(in_clause
pattern: (identifier) @font-lock-variable-name-face))
;; Yuan recommends also putting method definitions into the
;; 'function' category (thus keeping it in both). I've opted to
@ -322,6 +325,13 @@ values of OVERRIDE"
(operator_assignment
left: (identifier) @font-lock-variable-name-face))
:language language
:feature 'symbol
'((bare_symbol) @font-lock-constant-face
(delimited_symbol (string_content) @font-lock-constant-face)
(hash_key_symbol) @font-lock-constant-face
(simple_symbol) @font-lock-constant-face)
:language language
:feature 'error
'((ERROR) @font-lock-warning-face)

View File

@ -151,10 +151,10 @@ Argument LANGUAGE is either `typescript' or `tsx'."
:language language
:override t
:feature 'string
`((regex pattern: (regex_pattern)) @font-lock-string-face
`((regex pattern: (regex_pattern)) @font-lock-regexp-face
(string) @font-lock-string-face
(template_string) @js--fontify-template-string
(template_substitution ["${" "}"] @font-lock-builtin-face))
(template_substitution ["${" "}"] @font-lock-misc-punctuation-face))
:language language
:override t

View File

@ -1179,16 +1179,17 @@ See `treesit-simple-indent-presets'.")
;; TODO: Document.
(cons 'and (lambda (&rest fns)
(lambda (node parent bol &rest _)
(cl-reduce (lambda (a b) (and a b))
(mapcar (lambda (fn)
(funcall fn node parent bol))
fns)))))
(let (res)
(catch 'break
(dolist (fn fns)
(setq res (funcall fn node parent bol))
(unless res (throw 'break t))))
res))))
(cons 'or (lambda (&rest fns)
(lambda (node parent bol &rest _)
(cl-reduce (lambda (a b) (or a b))
(mapcar (lambda (fn)
(funcall fn node parent bol))
fns)))))
(seq-find
(lambda (fn) (funcall fn node parent bol))
fns))))
(cons 'not (lambda (fn)
(lambda (node parent bol &rest _)
(not (funcall fn node parent bol)))))
@ -1547,6 +1548,10 @@ RULES."
(pcase func
(`(query ,qry)
(list 'query (treesit-query-compile lang qry)))
(`(and . ,fns)
(cons 'and (mapcar #'optimize-func fns)))
(`(or . ,fns)
(cons 'or (mapcar #'optimize-func fns)))
(_ func)))
;; Optimize a rule (MATCHER ANCHOR OFFSET).
(optimize-rule (rule)

View File

@ -2220,7 +2220,9 @@ But if NO-TRUNCATE is non-nil, include them."
(if (widget-get current :inline)
(setq val value
fun :match-inline)
(setq val (car value)
(setq val (if (consp value)
(car value)
value)
fun :match))
(setq val value
fun :match))

View File

@ -267,6 +267,22 @@ return nil, even with a non-nil bubblep argument."
(should child)
(should (equal (widget-value widget) '(1 "One"))))))
;; Bug#60501
(ert-deftest widget-test-handle-spurious-inline ()
"Test the we can create a menu widget with an unnecessary :inline"
(with-temp-buffer
(widget-insert "Testing.\n\n")
(let* ((widget (widget-create 'menu-choice
:inline t
:value "*scratch*"
'(choice-item "*scratch*")))
(child (car (widget-get widget :children))))
(widget-insert "\n")
(use-local-map widget-keymap)
(widget-setup)
(should child)
(should (string-equal (widget-value widget) "*scratch*")))))
(ert-deftest widget-test-option-can-handle-choice ()
"Test that we can create a option widget with a choice correctly."
(with-temp-buffer