bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#23975: 25.0.94: defcustom error message is wrong when :type field ha


From: Andreas Schwab
Subject: bug#23975: 25.0.94: defcustom error message is wrong when :type field has a :match attribute
Date: Sun, 28 Jul 2019 13:49:32 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2.90 (gnu/linux)

On Jul 28 2019, Lars Ingebrigtsen <larsi@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@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."





reply via email to

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