GNU bug report logs - #63410
30.0.50; [FR] Optionally allow defcustom to check type for standard value

Previous Next

Package: emacs;

Reported by: Ruijie Yu <ruijie <at> netyu.xyz>

Date: Wed, 10 May 2023 05:37:01 UTC

Severity: wishlist

Found in version 30.0.50

Full log


View this message in rfc822 format

From: Ruijie Yu <ruijie <at> netyu.xyz>
To: 63410 <at> debbugs.gnu.org
Subject: bug#63410: 30.0.50; [FR] Optionally allow defcustom to check type for standard value
Date: Wed, 10 May 2023 13:22:34 +0800
Similar to `setopt' introduced in 29, which warns when a variable gets
assigned a value with an incorrect type, I hope `defcustom' can
(optionally) check that the standard value of a customizable variable is
correct.  This would help external as well as internal package authors
to catch errors on the types.

I don't know how to define such optionality though -- can/should it also
be a customizable variable?  Or maybe it should just be a
function/command which checks customizable variables (e.g., a single
variable; a group; all of them; etc.), and warns about all the type
mismatches along the way?

In addition, a "check all variables within this group (and
subgroups)" might be helpful as well.

At the moment, the only via workaround I know of to check existing value
type for any given variable is this:

    (setopt variable variable)

But this introduces the runtime cost of the :set function, which
sometimes do pretty expensive things like (re-) loading a package.

Another workaround I know of, of course, is to run

    M-x customize-variable

on the variable, but that is painfully slow compared to the first
workaround.

If no-one gets to it first, I may start looking into how to implement it
within a week or two.

-- 
Best,


RY




This bug report was last modified 1 year and 283 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.