emacs-devel
[Top][All Lists]
Advanced

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

Re: Community improvements to the Emacs Widget Library manual?


From: Michael Heerdegen
Subject: Re: Community improvements to the Emacs Widget Library manual?
Date: Thu, 13 Jul 2023 04:59:09 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Bryce <bovine@cyberscientist.ca> writes:

> [...] but the point is to /consume/ non-keyword arguments to
> `widget-create' in a widget-specific way (for property initialization
> or side-effects).
>
>     | (define-widget 'matchbox 'checkbox
>     |   "A cousin-level radiobutton, styled as a checkbox.
>     |
>     | The BNF for this widget is:
>     |
>     |     matchbox := (matchbox VALUE)
>     |              | matchbox
>     |
>     | VALUE is used to initialize :value.
>     |
>     | It operates like a radio-button, but at the cousin-level (however
>     | removed) rather than the sibling-level."
>     |   :value nil
>     |   :create
>     |   (lambda (widget-type)
>     |     (let (value)
>     |       (widget-create 'checkbox :value value))))
>
> Granted, the manual doesn't explicity advertise this functionality (see
> next quote; either no arguments, one keyword-argument pair, or multiple
> keyword-argument pairs), but it feels implied by writing elsewhere in
> the manual.
>
>     | -- Function: widget-create type [ keyword argument ]...

Not sure I understand the example (especially what the :create function
is supposed to do).  But specifying the value as first argument (to
`widget-create' or `widget-convert') works here for checkbox widgets,
e.g.

(let ((w (widget-convert 'checkbox t :help-echo "A help echo.")))
  (message "Value is: %S" (widget-value w)))

If you want something non-standard, you can provide a :widget-convert
argument (it is called in the middle of `widget-convert').  Some
built-in widgets use it, `item' for example.

I'm probably still missing something.


Michael.




reply via email to

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