emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master abeb29bfcc: Merge from origin/emacs-29


From: Stefan Kangas
Subject: master abeb29bfcc: Merge from origin/emacs-29
Date: Sat, 7 Jan 2023 00:44:50 -0500 (EST)

branch: master
commit abeb29bfcc68c578f11d59dcc1522738d493770a
Merge: 39b77970c6 9d410f8de6
Author: Stefan Kangas <stefankangas@gmail.com>
Commit: Stefan Kangas <stefankangas@gmail.com>

    Merge from origin/emacs-29
    
    9d410f8de64 (treesit-simple-indent-presets): Ensure 'and' works for a...
    ff66a5d324b (treesit--indent-rules-optimize): Optimize 'and' and 'or'...
    f2ebe43362c (treesit-simple-indent-presets): Short-circuit 'and' and ...
    2ea6ee5cbfa (font-lock-regexp-face): New face
    5ab03bcc433 Unify the string interpolation delimiters face across ts ...
    92e8c0c091c ruby-ts-mode: Highlight more kinds of parameters
    7420b6dcc37 Fix `pr-interface'
    699711786ac Further generic-related improvements in csharp-ts-mode (b...
    
    # Conflicts:
    #       etc/NEWS
---
 etc/NEWS.29                          |  1 +
 lisp/font-lock.el                    |  6 ++++++
 lisp/progmodes/csharp-mode.el        |  3 +++
 lisp/progmodes/js.el                 |  4 ++--
 lisp/progmodes/ruby-ts-mode.el       | 38 +++++++++++++++++++++++-------------
 lisp/progmodes/typescript-ts-mode.el |  4 ++--
 lisp/treesit.el                      | 21 ++++++++++++--------
 lisp/wid-edit.el                     |  4 +++-
 test/lisp/wid-edit-tests.el          | 16 +++++++++++++++
 9 files changed, 70 insertions(+), 27 deletions(-)

diff --git a/etc/NEWS.29 b/etc/NEWS.29
index 059278b08a..5901b2718e 100644
--- a/etc/NEWS.29
+++ b/etc/NEWS.29
@@ -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'.
 
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index 74881a14cc..99df8fb9e0 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -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."
diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el
index eb1d578daa..32ec772169 100644
--- a/lisp/progmodes/csharp-mode.el
+++ b/lisp/progmodes/csharp-mode.el
@@ -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)
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index 8a2a5f886e..881f4a83b1 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -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
diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el
index 349318e757..5f5de50043 100644
--- a/lisp/progmodes/ruby-ts-mode.el
+++ b/lisp/progmodes/ruby-ts-mode.el
@@ -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)
diff --git a/lisp/progmodes/typescript-ts-mode.el 
b/lisp/progmodes/typescript-ts-mode.el
index f2e27395a5..0a79ae0124 100644
--- a/lisp/progmodes/typescript-ts-mode.el
+++ b/lisp/progmodes/typescript-ts-mode.el
@@ -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
diff --git a/lisp/treesit.el b/lisp/treesit.el
index e7de110b9d..a7f453a889 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -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)
diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index 798db9f9dd..60bd2baa6f 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -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))
diff --git a/test/lisp/wid-edit-tests.el b/test/lisp/wid-edit-tests.el
index 3f5fcea0c3..b379c7c91a 100644
--- a/test/lisp/wid-edit-tests.el
+++ b/test/lisp/wid-edit-tests.el
@@ -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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]