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

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

bug#63410: 30.0.50; [FR] Optionally allow defcustom to check type for st


From: Ruijie Yu
Subject: bug#63410: 30.0.50; [FR] Optionally allow defcustom to check type for standard value
Date: Thu, 11 May 2023 10:25:41 +0800
User-agent: mu4e 1.11.3; emacs 30.0.50

Eli Zaretskii <eliz@gnu.org> writes:

>> Cc: "63410@debbugs.gnu.org" <63410@debbugs.gnu.org>
>> Date: Wed, 10 May 2023 22:51:14 +0800
>> From:  Ruijie Yu via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>> 
>> My request is that Emacs should (optionally, maybe behind a defcustom,
>> or configure, or cli flag, etc.) warn you warn a defcustom's standard
>> value does not match its declared type.
>
> Warn you at what time?  When defcustom is byte-compiled? when it is
> evaluated at run time? when the user says "M-x set-variable"?
> something else?

I was initially thinking of at runtime, but now that you mention it,
byte-compilation time sounds more reasonable.

So, I would say check the type unconditionally on byte-compilation time,
or when something is toggled on, check the type at runtime if a
defcustom is not compiled.

>> Since a similar warning is already in place for `setopt', I don't
>> think it is farfetched to request `defcustom' to follow suit.
>
> setopt says it when you invoke it.  But setopt is designed to be
> called as a function at run time, whereas defcustom isn't.

In that case, I had my semi-parallel second proposal: provide a command
that checks for a group of variables and see if types of all variables
within the group (or its subgroups) are correct.

-- 
Best,


RY





reply via email to

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