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

From: Mauro Aranda <[email-masked]>
Date: Wed, 4 Jan 2023 13:07:21 -0300

Robert Pluim <[email-masked]> writes:

 >>>>>> 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
 >     Mauro> 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
 >     Mauro> 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))

Yes, that should do.

Thanks for taking care of this.