From: Eshel Yaron Date: Sat, 11 Jan 2025 17:10:40 +0000 (+0100) Subject: Fix cherry-picking X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ddae64b1f9aa5f4bde21f1112a67a57aea1c712b;p=emacs.git Fix cherry-picking --- diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index 008da6e3b75..ac753ed4266 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -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 diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el index d8539ae5ed0..bccc26f1cac 100644 --- a/lisp/wid-edit.el +++ b/lisp/wid-edit.el @@ -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)))) + ;;; The `lazy' Widget. ;;