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

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

editable-list widgets: how to create one child automatically


From: Michael Heerdegen
Subject: editable-list widgets: how to create one child automatically
Date: Wed, 13 Mar 2024 08:23:52 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

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.

I often want an editable-list widget to be created along with one child
instead of none.  Zero childs often has no useful meaning in the context
of the widget, and starting with one child already created when the
editable-list widget gets inserted is often is good choice and nicer to
the user.

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?

TIA,

Michael.



reply via email to

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