help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: editable-list widgets: how to create one child automatically


From: Mauro Aranda
Subject: Re: editable-list widgets: how to create one child automatically
Date: Wed, 13 Mar 2024 07:41:04 -0300
User-agent: Mozilla Thunderbird

On 13/3/24 04:23, Michael Heerdegen wrote:
> Hello,
>
> and sorry to Mauro, I CC'd you directly because I know you are a widget
> expert, and there are only few of them.

Hi Michael.  I appreciate you CCing me, so no need to feel sorry.

> Is there some tool designed for this purpose I have missed?  So far the
> only way I know of is to specify a widget property
>
> #+begin_src emacs-lisp
>   :value-create
>   (lambda (w)
>     (unless (widget-get w :value)
>       (widget-put w :value (list my-first-default)))
>     (widget-editable-list-value-create w))
> #+end_src
>
> Is there a better way?
>

You should be able to specify the :value property directly, rather than
overriding :value-create.  Something like:

(widget-create 'editable-list
               :value (list my-first-default)
               ;; Change according to the child type.
               '(editable-field))

Does that not do what you want?





reply via email to

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