From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: custom-set-variables considered harmful Date: Mon, 04 Dec 2017 17:36:30 +0200 Message-ID: <83374qzerl.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1512401855 27715 195.159.176.226 (4 Dec 2017 15:37:35 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 4 Dec 2017 15:37:35 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Dec 04 16:37:27 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 1eLso8-0006hA-Bg for ged-emacs-devel@m.gmane.org; Mon, 04 Dec 2017 16:37:24 +0100 Original-Received: from localhost ([::1]:43748 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eLsoF-0000vj-Na for ged-emacs-devel@m.gmane.org; Mon, 04 Dec 2017 10:37:31 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58114) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eLsnW-0000ve-2N for emacs-devel@gnu.org; Mon, 04 Dec 2017 10:36:47 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eLsnS-0004oM-QB for emacs-devel@gnu.org; Mon, 04 Dec 2017 10:36:46 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:56285) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eLsnS-0004oF-N3; Mon, 04 Dec 2017 10:36:42 -0500 Original-Received: from [176.228.60.248] (port=4258 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1eLsnR-0004Qi-Ss; Mon, 04 Dec 2017 10:36:42 -0500 In-reply-to: (message from Stefan Monnier on Mon, 04 Dec 2017 08:48:06 -0500) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e 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:220694 Archived-At: > From: Stefan Monnier > Date: Mon, 04 Dec 2017 08:48:06 -0500 > > Based on the feedback, I added a config var to control the use of `setq'. > I also added a backward compatibility hack which makes it so that your > "new style config" will partly work in Emacs<27. Thanks. > Any objection to installing the patch below into `master`? No objections from me, but: . please add :version tags to defcustoms . please add some documentation, including a NEWS entry A couple of nits about doc strings below. > +(defcustom custom-mimic-plain-elisp nil > + "If non-nil, save user settings with the new format. IME, saying "new" in documentation is not a very good idea: it conveys no useful information, and after some time it is no longer "new". How about something like the below? If non-nil, save user settings using format that mimics hand-written code. Then you could lose the next sentence of the doc string: > +This new format tries to mimick the code that would be written by hand > +in plain Elisp. > + But it relies on `custom-autogenerated-user-settings' which > +is a new macro in Emacs-27, so settings saved with this will not work > +reliably in Emacs<27 (although a backward compatibility trick is used > +which should make them work to some extent)." This sounds like a comment, not sure if it will be useful to users. > +(defcustom custom-mimic-plain-elisp-use-setq nil > + "If non-nil, use `setq' when possible in generated code. I'd suggest "in code generated by `custom-mimic-plain-elisp'". > +(defmacro custom-autogenerated-user-settings (&rest body) > + "Install user customizations of variable values specified in ARGS. Ehm... which "ARGS" are those? There's just BODY.