unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: Emacs mailing list <help-gnu-emacs@gnu.org>
Cc: Mauro Aranda <maurooaranda@gmail.com>
Subject: editable-list widgets: how to create one child automatically
Date: Wed, 13 Mar 2024 08:23:52 +0100	[thread overview]
Message-ID: <871q8ebnnb.fsf@web.de> (raw)

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	other threads:[~2024-03-13  7:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-13  7:23 Michael Heerdegen [this message]
2024-03-13 10:41 ` editable-list widgets: how to create one child automatically 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871q8ebnnb.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=help-gnu-emacs@gnu.org \
    --cc=maurooaranda@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).