From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gregory Heytings 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 09:30:21 +0000 Message-ID: <0d48a230848de1d1b255@heytings.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> <83h7eqf9wx.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="qvN2IHJ05n" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27319"; mail-complaints-to="usenet@ciao.gmane.io" Cc: larsi@gnus.org, hmelman@gmail.com, 21695@debbugs.gnu.org, rms@gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Sep 12 11:32:36 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 1mPLql-0006xP-JY for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Sep 2021 11:32:35 +0200 Original-Received: from localhost ([::1]:42950 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPLqk-0003mI-M3 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Sep 2021 05:32:34 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45780) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPLpG-00025X-L9 for bug-gnu-emacs@gnu.org; Sun, 12 Sep 2021 05:31:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58763) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mPLpG-0003FT-BB for bug-gnu-emacs@gnu.org; Sun, 12 Sep 2021 05:31:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mPLpG-00070i-1b for bug-gnu-emacs@gnu.org; Sun, 12 Sep 2021 05:31:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Gregory Heytings Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 12 Sep 2021 09:31:01 +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.163143902826906 (code B ref 21695); Sun, 12 Sep 2021 09:31:01 +0000 Original-Received: (at 21695) by debbugs.gnu.org; 12 Sep 2021 09:30:28 +0000 Original-Received: from localhost ([127.0.0.1]:42076 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPLoi-0006zu-Eh for submit@debbugs.gnu.org; Sun, 12 Sep 2021 05:30:28 -0400 Original-Received: from heytings.org ([95.142.160.155]:57206) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPLoc-0006zh-Vc for 21695@debbugs.gnu.org; Sun, 12 Sep 2021 05:30:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20210101; t=1631439021; bh=J3rEooXDCoMHfn9FKPMk036gtpx8An7F2pZnJVEcy6M=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=lQ/VearNQ+kgTdqT70HN9I3PcNWctaFvDVLLxI1KzhduxGSaYA4z13aSzcdlvda2r yKPSPyoBVpUQXl9DS8Gfvp2dsukbv8V8LUQCubaULlU8K1iGIROPF8yesMfTj8uuvH /qI33fmgqCUmajpjyLtjOGAQ3S5WL7L/IpYYoTLnNnG0cVW7KwNkL0Dhb1LiVdXYeC WuVnDln7MVKXC60iprXMngyTXeDmixjBoes13ZSe1vgVY9LZcKd2n2KHd5+1Jz6Hhp 2XqRbYtPwm8L30D8IQNDqFZlES8JU+XHST7d0Fi43vGaFFTFDsj1zD+LQr0xRYYgEs sVUJwBS7ULHIA== In-Reply-To: <83h7eqf9wx.fsf@gnu.org> Content-ID: <0d48a230842bb9c9034e@heytings.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" Xref: news.gmane.io gmane.emacs.bugs:214125 Archived-At: --qvN2IHJ05n Content-Type: text/plain; charset=us-ascii; format=flowed Content-ID: <0d48a23084dfdc35b532@heytings.org> >> +** '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. > No, that wasn't the conclusion. Most variable with :set can safely be set by setq *before* the file in which they are declared is loaded. And no warnings are displayed in that case. But all variables with :set cannot be safely be set by setq *after* the file in which they are declared has been loaded. And warnings are displayed in that case. > > What will happen if setq is in the user's init file? We generally delay > warnings until after the startup in those cases. > With the following .emacs: (require 'allout) (setq allout-auto-activation t) a warning is displayed, but I don't know if this is during of after the startup. At least it is visible when startup has completed. > > Also, warnings.el is not preloaded, so this call could barf in some > valid cases. > That's not what I see: ;;;###autoload (defun display-warning (type message &optional level buffer-name) > > OTOH, setq is a primitive written in C, so ther should be no need to > call intern for it. > Okay, updated patch attached. > > 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? > With the updated patch, on my laptop, the execution of setq takes ~48 nanoseconds instead of ~40 nanoseconds. Which seems reasonable. --qvN2IHJ05n Content-Type: text/x-diff; name=Warn-when-custom-variable-is-wrongly-set.patch; charset=us-ascii Content-Transfer-Encoding: base64 Content-ID: <0d48a23084da18d01d42@heytings.org> Content-Description: Content-Disposition: attachment; filename=Warn-when-custom-variable-is-wrongly-set.patch RnJvbSA3MjNlODNiMjBmMDc3ZWUzNmU4Nzg0YjcxMDFiNGUyMGFjZTY0OGY5 IE1vbiBTZXAgMTcgMDA6MDA6MDAgMjAwMQ0KRnJvbTogR3JlZ29yeSBIZXl0 aW5ncyA8Z3JlZ29yeUBoZXl0aW5ncy5vcmc+DQpEYXRlOiBTdW4sIDEyIFNl cCAyMDIxIDA5OjIyOjEzICswMDAwDQpTdWJqZWN0OiBbUEFUQ0hdIFdhcm4g d2hlbiBjdXN0b20gdmFyaWFibGUgaXMgd3JvbmdseSBzZXQuDQoNCiogc3Jj L2V2YWwuYyAoRnNldHEpOiBEaXNwbGF5IHdhcm5pbmcgd2hlbiBhIGN1c3Rv bSB2YXJpYWJsZSB3aXRoIGEgOnNldA0KcHJvcGVydHkgaXMgc2V0IHdpdGgg c2V0cS4gIFdhcm5pbmdzIGFyZSBkaXNwbGF5ZWQgb25seSBmb3IgY3VzdG9t IHZhcmlhYmxlcw0Kd2hvc2UgZmlsZXMgaGF2ZSBiZWVuIGxvYWRlZCBhbmQg dGhhdCBoYXZlIGEgOnNldCBwcm9wZXJ0eS4gIE5vIHdhcm5pbmdzIGFyZQ0K ZGlzcGxheWVkIG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