From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.devel Subject: RE: custom-set-variables considered harmful Date: Wed, 29 Nov 2017 07:03:39 -0800 (PST) Message-ID: <8782ed42-3aec-4111-b4f0-471c838e7370@default> 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 1511967856 28558 195.159.176.226 (29 Nov 2017 15:04:16 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 29 Nov 2017 15:04:16 +0000 (UTC) Cc: Philippe Vaucher , emacs-devel To: Stefan Monnier , =?utf-8?B?RWxpYXMgTcOlcnRlbnNvbg==?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Nov 29 16:04:04 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 1eK3u7-0006bm-EX for ged-emacs-devel@m.gmane.org; Wed, 29 Nov 2017 16:04:03 +0100 Original-Received: from localhost ([::1]:43539 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eK3uB-0007oG-DS for ged-emacs-devel@m.gmane.org; Wed, 29 Nov 2017 10:04:07 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46564) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eK3tw-0007o7-5J for emacs-devel@gnu.org; Wed, 29 Nov 2017 10:03:58 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eK3tq-0002js-BZ for emacs-devel@gnu.org; Wed, 29 Nov 2017 10:03:52 -0500 Original-Received: from userp1040.oracle.com ([156.151.31.81]:25243) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eK3tq-0002jX-2T for emacs-devel@gnu.org; Wed, 29 Nov 2017 10:03:46 -0500 Original-Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id vATF3fuU003327 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 29 Nov 2017 15:03:43 GMT Original-Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id vATF3fIF019779 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 29 Nov 2017 15:03:41 GMT Original-Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id vATF3fc6012602; Wed, 29 Nov 2017 15:03:41 GMT In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.4615.0 (x86)] X-Source-IP: userv0021.oracle.com [156.151.31.71] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] [fuzzy] X-Received-From: 156.151.31.81 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:220519 Archived-At: > > Thus, if you use =E2=80=98setq=E2=80=99 instead of =E2=80=98custom-set-= variable=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. >=20 > 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. >=20 > > 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 set= ter function > > after the fact. >=20 > Looking at gnu-apl-mode.el, I get the impression that this is no > exception: >=20 > (setq gnu-apl-mode-map-prefix "C-") > (require 'gnu-apl-mode) >=20 > will result in the exact same state as >=20 > (customize-set-variable 'gnu-apl-mode-map-prefix "C-") > (require 'gnu-apl-mode) >=20 > after gnu-apl-mode is loaded, OTOH you indeed need to use > customize-set-variable because a setq would have no real effect. It may be the case that many uses of `setq' amount to the same thing as using `c-s-var*'. But I'm not sure what that changes. Here's a crazy possibility (not a suggestion, but maybe food for thought): Make `setq' do `customize-set-variable' for an option and do what it does now otherwise. (Ducks for cover...)