GNU bug report logs -
#23975
25.0.94: defcustom error message is wrong when :type field has a :match attribute
Previous Next
Reported by: rswgnu <at> gmail.com
Date: Wed, 13 Jul 2016 20:05:02 UTC
Severity: minor
Tags: fixed
Found in version 25.0.94
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On Jul 28 2019, Lars Ingebrigtsen <larsi <at> gnus.org> wrote:
> So, for your defcustom (or "widget" at this point):
>
> (widget-get w :match)
> => (lambda (widget value) (and (integerp value) (> value 0) (< value 1000)))
>
> If that fails, then we get the error with
>
> (widget-get w :type-error)
> => "This field should contain an integer"
>
> So far so bad -- this means that custom doesn't actually call the
> integerp check at all for defcustoms with an explicit :match.
That's because the :match overrides the parent :match (defined by
restricted-sexp). That's how OOP is working in general, I suppose.
> Here's another defcustom without a custom :match:
>
> (widget-get w2 :match)
> => widget-restricted-sexp-match
>
> and that function does
>
> (widget-get w2 :match-alternatives)
> => (integerp)
>
> and then calls `integerp'. Your defcustom also has this, but it's never
> called:
>
> (widget-get w :match-alternatives)
> => (integerp)
:match-alternatives is only used by widget-restricted-sexp-match, which
is overridden by the custom :match.
Andreas.
--
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
This bug report was last modified 4 years and 338 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.