unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* editable-list widgets: how to create one child automatically
@ 2024-03-13  7:23 Michael Heerdegen
  2024-03-13 10:41 ` Mauro Aranda
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Heerdegen @ 2024-03-13  7:23 UTC (permalink / raw)
  To: Emacs mailing list; +Cc: Mauro Aranda

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.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-03-15 12:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-13  7:23 editable-list widgets: how to create one child automatically Michael Heerdegen
2024-03-13 10:41 ` Mauro Aranda
2024-03-14  1:58   ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-03-14 11:19     ` Mauro Aranda
2024-03-15 12:53       ` Michael Heerdegen via Users list for the GNU Emacs text editor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).