From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: custom-set-variables considered harmful Date: Wed, 29 Nov 2017 10:00:34 -0500 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1511967539 23271 195.159.176.226 (29 Nov 2017 14:58:59 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 29 Nov 2017 14:58:59 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Philippe Vaucher , emacs-devel To: Elias =?windows-1252?Q?M=E5rtenson?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Nov 29 15:58:51 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eK3p4-0005XG-9t for ged-emacs-devel@m.gmane.org; Wed, 29 Nov 2017 15:58:50 +0100 Original-Received: from localhost ([::1]:43512 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eK3pB-0004St-GA for ged-emacs-devel@m.gmane.org; Wed, 29 Nov 2017 09:58:57 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44604) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eK3oz-0004RC-SJ for emacs-devel@gnu.org; Wed, 29 Nov 2017 09:58:46 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eK3ov-0000qY-1Y for emacs-devel@gnu.org; Wed, 29 Nov 2017 09:58:45 -0500 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]:49584) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eK3ou-0000q5-Rr for emacs-devel@gnu.org; Wed, 29 Nov 2017 09:58:40 -0500 Original-Received: from lechazo.home (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id vATEwZQG027322; Wed, 29 Nov 2017 09:58:35 -0500 Original-Received: by lechazo.home (Postfix, from userid 20848) id C512D60122; Wed, 29 Nov 2017 10:00:34 -0500 (EST) In-Reply-To: ("Elias =?windows-1252?Q?M=E5rtenson=22's?= message of "Wed, 29 Nov 2017 11:36:21 +0800") X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 2 Rules triggered EDT_SA_DN_PASS=0, RV6169=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6169> : inlines <6193> : streams <1771683> : uri <2542170> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.20 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:220518 Archived-At: > Thus, if you use =E2=80=98setq=E2=80=99 instead of =E2=80=98custom-set-va= riable=E2=80=99 you need to > manually check every single variable to ensure they don't have setter > functions assigned. If you want to be thorough (nobody is) you also > need to check them every time your modules are updated. This is not > just a theoretical situation. Note that there are also many situations where the var has a setter, yet doing (setq foo val) on it from your ~/.emacs will still work correctly (as long as you do it before loading the library). I'd argue it's actually the most frequent case. > It happened in gnu-apl-mode, a library for which I am the maintainer. > In it, the variable =E2=80=98gnu-apl-mode-map-prefix=E2=80=99 got a sette= r function > after the fact. Looking at gnu-apl-mode.el, I get the impression that this is no exception: (setq gnu-apl-mode-map-prefix "C-") (require 'gnu-apl-mode) will result in the exact same state as (customize-set-variable 'gnu-apl-mode-map-prefix "C-") (require 'gnu-apl-mode) after gnu-apl-mode is loaded, OTOH you indeed need to use customize-set-variable because a setq would have no real effect. Stefan