From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ruijie Yu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs 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 Message-ID: References: <83ttwk6vq4.fsf@gnu.org> Reply-To: Ruijie Yu Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1758"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.11.3; emacs 30.0.50 Cc: 63410@debbugs.gnu.org, drew.adams@oracle.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu May 11 04:27:25 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pww1d-0000E9-C3 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 11 May 2023 04:27:25 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pww1I-0004xq-HN; Wed, 10 May 2023 22:27:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pww1H-0004xN-AU for bug-gnu-emacs@gnu.org; Wed, 10 May 2023 22:27:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pww1F-0007h6-RI for bug-gnu-emacs@gnu.org; Wed, 10 May 2023 22:27:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pww1F-0003YJ-N4 for bug-gnu-emacs@gnu.org; Wed, 10 May 2023 22:27:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ruijie Yu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 11 May 2023 02:27:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63410 X-GNU-PR-Package: emacs Original-Received: via spool by 63410-submit@debbugs.gnu.org id=B63410.168377196913580 (code B ref 63410); Thu, 11 May 2023 02:27:01 +0000 Original-Received: (at 63410) by debbugs.gnu.org; 11 May 2023 02:26:09 +0000 Original-Received: from localhost ([127.0.0.1]:49357 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pww0N-0003Wv-Ic for submit@debbugs.gnu.org; Wed, 10 May 2023 22:26:09 -0400 Original-Received: from netyu.xyz ([152.44.41.246]:34358 helo=mail.netyu.xyz) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pww0H-0003WX-Ve for 63410@debbugs.gnu.org; Wed, 10 May 2023 22:26:05 -0400 Original-Received: from fw.net.yu.netyu.xyz ( [222.248.4.98]) by netyu.xyz (OpenSMTPD) with ESMTPSA id ffecc44c (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 11 May 2023 02:26:00 +0000 (UTC) In-reply-to: <83ttwk6vq4.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:261537 Archived-At: Eli Zaretskii 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" >> >> 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