From: Ruijie Yu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 63410@debbugs.gnu.org, drew.adams@oracle.com
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 [thread overview]
Message-ID: <sdv7ctfa9ju.fsf@netyu.xyz> (raw)
In-Reply-To: <83ttwk6vq4.fsf@gnu.org>
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
next prev parent reply other threads:[~2023-05-11 2:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-10 5:22 bug#63410: 30.0.50; [FR] Optionally allow defcustom to check type for standard value Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-10 13:36 ` Drew Adams
2023-05-10 14:51 ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-10 15:40 ` Eli Zaretskii
2023-05-11 2:25 ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-05-11 14:08 ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
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=sdv7ctfa9ju.fsf@netyu.xyz \
--to=bug-gnu-emacs@gnu.org \
--cc=63410@debbugs.gnu.org \
--cc=drew.adams@oracle.com \
--cc=eliz@gnu.org \
--cc=ruijie@netyu.xyz \
/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).