[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#33566: 26; `group' :type for defcustom
From: |
Drew Adams |
Subject: |
bug#33566: 26; `group' :type for defcustom |
Date: |
Sat, 1 Dec 2018 16:31:39 -0800 (PST) |
> This appears to be the same issue as bug #31309
>
> https://urldefense.proofpoint.com/v2/url?u=https-
> 3A__debbugs.gnu.org_cgi_bugreport.cgi-3Fbug-
> 3D31309&d=DwIDaQ&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=kI3P6l
> jGv6CTHIKju0jqInF6AOwMCYRDQUmqX22rJ98&m=q_aD3h6_uQ5XqacM7h8h0yyr4bJrYed
> Kx_CcGGTUXRU&s=BlmxwvxgNdZTq6QqgdDRglwd0qa8LpG-SLOp13SLoV4&e=
>
>
> At present in wid-edit.el we see:
>
> (define-widget 'group 'default
> [...]
> :format "%v"
>
> And that format of "%v" is triggering the error.
>
> In #31309 I noted that:
>
> > the parent `editable-field' widget says:
> > "Note: In an ‘editable-field’ widget, the ‘%v’ escape must be
> preceded
> > by some other text in the ‘:format’ string (if specified)."
>
> And so I copied the :format "%{%t%}: %v" used by the 'string type.
>
> If we make that same change here:
>
> (define-widget 'group 'default
> [...]
> :format "%{%t%}: %v"
>
> Then the example code from this new bug works.
>
>
> Possibly there are other such bugs here as well?
>
> 8 matches for ":format "%v"" in buffer: wid-edit.el
> 594: :type '(repeat (cons :format "%v"
> 597: (string :format "%v")))))
> 1870: :format "%v"
> 2214: :format "%v"
> 2392: :format "%v"
> 2749: :format "%v"
> 2905: :format "%v"
> 3565: (cons :format "%v"
Great. Good catch and follow-up.
A couple things:
This (e.g. the recipe in bug #33566) has apparently been broken since at least
Emacs 20. But in Emacs 20 the message in *Messages* is just "Bad format".
But :group is supposed to not show any :tag. So I think this is what we should
use:
(define-widget 'group 'default
"A widget which groups other widgets inside."
:convert-widget 'widget-types-convert-widget
:copy 'widget-types-copy
:format ":\n%v" ; <================
:value-create 'widget-group-value-create
:value-get 'widget-editable-list-value-get
:default-get 'widget-group-default-get
:validate 'widget-children-validate
:match 'widget-group-match
:match-inline 'widget-group-match-inline)
There doesn't seem to be any way to eliminate the `:' altogether, though.
I think the doc needs to be corrected in (widget) Editable Text Fields. This
is not correct/sufficient;
*Warning:* In an ‘editable-field’ widget, the ‘%v’
escape must be preceded by some other text in the
‘:format’ string (if specified).
It's not sufficient that just any old text precede
the `%v'. There must be a colon, AFAICT.
It should instead say something like this:
*Warning:* In an ‘editable-field’ widget, the ‘%v’
escape must be preceded by a colon (`:') in the
‘:format’ string (if specified). No tag name need
precede the colon, but the colon must be present.
(Additional text can follow the colon and precede
the ‘%v’.)
(Perhaps more testing or checking of just what can
precede the %v needs to be done.)
I'd also drop the "*Warning:*", personally, and
instead say that this is necessary or you get a
bad format message (or some such).