unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#6572: 24.0.50; error string from `custom-variable-set'
@ 2010-07-06 15:59 Drew Adams
  2022-05-09 14:55 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Drew Adams @ 2010-07-06 15:59 UTC (permalink / raw)
  To: 6572

If the defcustom :type is (restricted-sexp...), and you try to customize
to a value that does not respect this :type, you get a generic error
message: "The specified value is not valid".
 
This message could & should be more specific, referencing the sexp that
defines the restriction the value should respect.  E.g. if :type is:
 
(restricted-sexp :match-alternatives 'natnump)
 
Then the message would be more helpful if it said something like this:
 
"Specified value does not satisfy `natnump'"
 
If :type is:
 
(restricted-sexp :match-alternatives
                 (lambda (x) (and (foop x) (not (barp x)))))
 
Then this message is more helpful:
 
"Specified value does not satisfy
 `(lambda (x) (and (foop x) (not (barp x))))'"
 
If :type is:
 
(restricted-sexp :match-alternatives (integerp 't 'nil))
 
Then this message is more helpful:
 
"Specified value does not satisfy `(integerp 't 'nil)'"
 
In all cases, it is better to give the user some indication of what the
value should be, even if that is via a Lisp sexp.
 
Yes, the doc string should make clear the permissible values, but this
additional info in the message can also help.  It is at least as helpful
as the ubiquitous message "(wrong-type-argument integerp "abc")".
 

In GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600)
 of 2010-06-28 on 3249CTO
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (4.4) --no-opt --cflags -Ic:/xpm/include'
 






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

* bug#6572: 24.0.50; error string from `custom-variable-set'
  2010-07-06 15:59 bug#6572: 24.0.50; error string from `custom-variable-set' Drew Adams
@ 2022-05-09 14:55 ` Lars Ingebrigtsen
  2022-05-09 15:23   ` Drew Adams
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2022-05-09 14:55 UTC (permalink / raw)
  To: Drew Adams; +Cc: 6572

"Drew Adams" <drew.adams@oracle.com> writes:

> If the defcustom :type is (restricted-sexp...), and you try to customize
> to a value that does not respect this :type, you get a generic error
> message: "The specified value is not valid".
>
> This message could & should be more specific, referencing the sexp that
> defines the restriction the value should respect.  E.g. if :type is:
>
> (restricted-sexp :match-alternatives 'natnump)
>
> Then the message would be more helpful if it said something like this:
>
> "Specified value does not satisfy `natnump'"
>
> If :type is:
>
> (restricted-sexp :match-alternatives
>                  (lambda (x) (and (foop x) (not (barp x)))))
>
> Then this message is more helpful:
>
> "Specified value does not satisfy
>  `(lambda (x) (and (foop x) (not (barp x))))'"

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

Well, I can see the charm of doing something like this, but the
Customize interface is for users, and telling them

 "Specified value does not satisfy
  `(lambda (x) (and (foop x) (not (barp x))))'"

is way too nerdy even for Emacs.  Users should look at the doc string
that will explain this to them in words.

So I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#6572: 24.0.50; error string from `custom-variable-set'
  2022-05-09 14:55 ` Lars Ingebrigtsen
@ 2022-05-09 15:23   ` Drew Adams
  2022-05-09 15:57     ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Drew Adams @ 2022-05-09 15:23 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 6572@debbugs.gnu.org

> > This message could & should be more specific,
> > referencing the sexp that defines the restriction
> > the value should respect.  E.g., if :type is:
> >
> > (restricted-sexp
> >    :match-alternatives
> >    (lambda (x) (and (foop x) (not (barp x)))))
> >
> > Then this message is more helpful:
> >
> > "Specified value does not satisfy
> >  `(lambda (x) (and (foop x) (not (barp x))))'"

And it's not difficult to provide that help.

> Well, I can see the charm of doing something like this, 
> but the Customize interface is for users,
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Yes, it is.  And that's who we should help, by
fixing this as suggested: users.  In this case,
users who try to provide a value that's required,
as specified by that restricted-sexp.

> and telling them
> 
>  "Specified value does not satisfy
>   `(lambda (x) (and (foop x) (not (barp x))))'"
> 
> is way too nerdy even for Emacs.  Users should look 
> at the doc string that will explain this to them in words.
> 
> So I'm closing this bug report.

It's not about "charm".  It's about helping users.
Users of Customize include everyone, including
users who can understand Lisp.  If a user doesn't
understand that improved message, s?he's more
likely to get help from others by providing that
helpful message.

A doc string is important.  That doesn't mean we
can't also have better error messages.

Yet another too-bad "I just love closing bugs".





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

* bug#6572: 24.0.50; error string from `custom-variable-set'
  2022-05-09 15:23   ` Drew Adams
@ 2022-05-09 15:57     ` Eli Zaretskii
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2022-05-09 15:57 UTC (permalink / raw)
  To: Drew Adams; +Cc: larsi, 6572

> From: Drew Adams <drew.adams@oracle.com>
> Date: Mon, 9 May 2022 15:23:07 +0000
> 
> Yet another too-bad "I just love closing bugs".

And yet another case of Drew's being unable to accept that the
maintainers' judgment can legitimately be different from his.





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

end of thread, other threads:[~2022-05-09 15:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-06 15:59 bug#6572: 24.0.50; error string from `custom-variable-set' Drew Adams
2022-05-09 14:55 ` Lars Ingebrigtsen
2022-05-09 15:23   ` Drew Adams
2022-05-09 15:57     ` Eli Zaretskii

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