From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#21695: 25.0.50; Change most occurrences of `setq' in Emacs manual to `customize-set-variable'? Really? Date: Sun, 12 Sep 2021 11:57:50 +0300 Message-ID: <83h7eqf9wx.fsf@gnu.org> References: <97d3ff2c-9e72-4004-88a9-08130ac99a74@default> <838s0fpixr.fsf@gnu.org> <83k0jtr45c.fsf@gnu.org> <87v93avtoe.fsf@gnus.org> <87r1dyvtav.fsf@gnus.org> <87mtolx6de.fsf@gnus.org> <87ilz9x5c8.fsf@gnus.org> <87y284rb1z.fsf@gnus.org> <0d48a23084a8b0435f37@heytings.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39225"; mail-complaints-to="usenet@ciao.gmane.io" Cc: larsi@gnus.org, hmelman@gmail.com, 21695@debbugs.gnu.org, rms@gnu.org To: Gregory Heytings Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Sep 12 10:59:22 2021 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 1mPLKc-000A31-4h for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Sep 2021 10:59:22 +0200 Original-Received: from localhost ([::1]:59158 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPLKa-0002LS-7R for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Sep 2021 04:59:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41244) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPLKI-0002LK-Is for bug-gnu-emacs@gnu.org; Sun, 12 Sep 2021 04:59:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58728) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mPLKI-00011M-B1 for bug-gnu-emacs@gnu.org; Sun, 12 Sep 2021 04:59:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mPLKI-0006Ct-AH for bug-gnu-emacs@gnu.org; Sun, 12 Sep 2021 04:59:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 12 Sep 2021 08:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21695 X-GNU-PR-Package: emacs Original-Received: via spool by 21695-submit@debbugs.gnu.org id=B21695.163143710023810 (code B ref 21695); Sun, 12 Sep 2021 08:59:02 +0000 Original-Received: (at 21695) by debbugs.gnu.org; 12 Sep 2021 08:58:20 +0000 Original-Received: from localhost ([127.0.0.1]:42041 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPLJc-0006Bx-2L for submit@debbugs.gnu.org; Sun, 12 Sep 2021 04:58:20 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:52358) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPLJZ-0006Bh-Fr for 21695@debbugs.gnu.org; Sun, 12 Sep 2021 04:58:18 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:53956) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPLJT-0000LE-Iq; Sun, 12 Sep 2021 04:58:11 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:3312 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPLJK-00058O-Oj; Sun, 12 Sep 2021 04:58:03 -0400 In-Reply-To: <0d48a23084a8b0435f37@heytings.org> (message from Gregory Heytings on Sun, 12 Sep 2021 08:23:01 +0000) 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" Xref: news.gmane.io gmane.emacs.bugs:214121 Archived-At: > Date: Sun, 12 Sep 2021 08:23:01 +0000 > From: Gregory Heytings > Cc: 21695@debbugs.gnu.org, hmelman@gmail.com, Richard Stallman > > +-- > +** 'setq' displays a warning when 'customize-set-variable' should have been used. > +Some custom variables need to be set with 'customize-set-variable', because > +they were designed to be set through the Customization interface and have a > +:set lambda form which does other things after they have been set. I thought the conclusion was that most variables with :set can be safely set by setq, isn't that so? If so, these warnings will mostly annoy. > --- a/src/eval.c > +++ b/src/eval.c > @@ -525,8 +525,15 @@ usage: (setq [SYM VAL]...) */) > : Qnil); > if (!NILP (lex_binding)) > XSETCDR (lex_binding, val); /* SYM is lexically bound. */ > - else > + else { > + if (!NILP (Fget (sym, intern ("custom-set")))) > + call2 (intern ("display-warning"), intern ("setq"), > + CALLN (Fformat, > + build_string > + ("`%s' should be set with `customize-set-variable'"), > + sym)); > Fset (sym, val); /* SYM is dynamically bound. */ > + } What will happen if setq is in the user's init file? We generally delay warnings until after the startup in those cases. Also, warnings.el is not preloaded, so this call could barf in some valid cases. OTOH, setq is a primitive written in C, so ther should be no need to call intern for it. And finally, do we really want to slow down each setq by calling intern and Fget? setq is many times used inside tight loops. I'm not sure the resulting run-time penalty is justified. Did you measure the effect of this on performance?