]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix cherry-picking
authorEshel Yaron <me@eshelyaron.com>
Sat, 11 Jan 2025 17:10:40 +0000 (18:10 +0100)
committerEshel Yaron <me@eshelyaron.com>
Sun, 12 Jan 2025 10:59:01 +0000 (11:59 +0100)
lisp/progmodes/typescript-ts-mode.el
lisp/wid-edit.el

index 008da6e3b75f20aeab59ea6b28f9290d2e7d44c3..ac753ed426696f089feeb10df8d9ed92516040ec 100644 (file)
@@ -632,7 +632,8 @@ at least 3 (which is the default value)."
                                        '("jsx_element"
                                          "jsx_self_closing_element"))))
                    (text ,(regexp-opt '("comment"
-                                        "template_string"))))))
+                                        "template_string"))
+                         'symbols))))
 
     ;; Font-lock.
     (setq-local treesit-font-lock-settings
index d8539ae5ed09aee19fb1fdf106be0f16b1a51a41..bccc26f1cac71d78df93f1d9c9096500f16551a8 100644 (file)
@@ -3142,6 +3142,9 @@ The following properties have special meanings for this widget:
   (let* ((string (widget-get widget :value))
         (symbol (intern string)))
     (cond
+     ((and (fboundp symbol) (boundp symbol))
+      ;; If there are two doc strings, give the user a way to pick one.
+      (apropos (concat "\\`" (regexp-quote string) "\\'")))
      ((fboundp symbol)
       (describe-function symbol))
      ((facep symbol)
@@ -3890,6 +3893,30 @@ or a list with the default value of each component of the list WIDGET."
   (and (consp value)
        (widget-group-match widget
                           (widget-apply widget :value-to-internal value))))
+
+(defun widget-single-or-list-to-internal (widget val)
+  (if (listp val) val
+    (cons val (make-list (1- (length (widget-get widget :args))) nil))))
+
+(define-widget 'single-or-list 'group
+  "Either a single value (`nlistp') or a list of values (`listp').
+
+If the initial value is `nlistp', the first child widget gets
+that value and the other children get nil.
+
+If the first child's value is `nlistp' and the other children are
+nil, then `widget-value' just returns the first child's value."
+  ;; The internal value is always a list; only :value-to-internal and
+  ;; :match ever get called with the external value, which might be
+  ;; `nlistp'.
+  :value-to-external (lambda (_ val)
+                       (if (and (nlistp (car val))
+                                (cl-every #'null (cdr val)))
+                           (car val) val))
+  :value-to-internal #'widget-single-or-list-to-internal
+  :match (lambda (widget val)
+           (widget-group-match widget (widget-single-or-list-to-internal widget val))))
+
 \f
 ;;; The `lazy' Widget.
 ;;