Subject: Re: bug#60501: 28.2; pr-interface: widget-default-create: Wrong type argument

From: Robert Pluim <[email-masked]>
Date: Wed, 04 Jan 2023 17:00:30 +0100

>>>>> On Wed, 4 Jan 2023 12:21:55 -0300, Mauro Aranda <[email-masked]> said:

    Mauro> I don't have a lot of time right now, but I took a look at the code in
    Mauro> printing.el and I don't really understand why its using :inline t
    Mauro> when creating the menu-choice widget, since the values seem to be
    Mauro> strings or symbols.  That is, nothing that needs to be inlined.

OK. I canʼt comment on that, but we should try to be defensive

    Mauro> I wasn't aware of this breakage, of course, but it looks like I
    Mauro> should've made the code be more defensive (i.e., use car-safe instead of
    Mauro> car).

How about this (using car-safe would result in nil):

diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index 8250316bcc7..f4a49f58bed 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -2231,7 +2231,9 @@ widget-choice-value-create
             (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))

Robert
--