unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Phil Sainty <psainty@orcon.net.nz>, 33566@debbugs.gnu.org
Subject: bug#33566: 26; `group' :type for defcustom
Date: Sat, 1 Dec 2018 16:31:39 -0800 (PST)	[thread overview]
Message-ID: <ce88eeed-5ca7-4b79-972d-b5baa472a1e5@default> (raw)
In-Reply-To: <1df4e5f4-4410-d907-0fbb-82453e73f74b@orcon.net.nz>

> 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).





  reply	other threads:[~2018-12-02  0:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-01 20:44 bug#33566: 26; `group' :type for defcustom Drew Adams
2018-12-01 23:11 ` Phil Sainty
2018-12-02  0:31   ` Drew Adams [this message]
2018-12-03 20:49 ` bug#33566: [PATCH] " Drew Adams
2018-12-22 23:35   ` Drew Adams
2018-12-29  8:04     ` Eli Zaretskii

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=ce88eeed-5ca7-4b79-972d-b5baa472a1e5@default \
    --to=drew.adams@oracle.com \
    --cc=33566@debbugs.gnu.org \
    --cc=psainty@orcon.net.nz \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).