From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Robert Weiner Newsgroups: gmane.emacs.devel Subject: Re: custom-set-variables considered harmful Date: Mon, 4 Dec 2017 11:05:32 -0500 Message-ID: References: Reply-To: rswgnu@gmail.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="94eb2c04363c233e47055f85e5c9" X-Trace: blaine.gmane.org 1512403743 17155 195.159.176.226 (4 Dec 2017 16:09:03 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 4 Dec 2017 16:09:03 +0000 (UTC) Cc: emacs-devel To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Dec 04 17:08:58 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 1eLtIf-00048L-Nh for ged-emacs-devel@m.gmane.org; Mon, 04 Dec 2017 17:08:57 +0100 Original-Received: from localhost ([::1]:43879 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eLtIn-00029J-0e for ged-emacs-devel@m.gmane.org; Mon, 04 Dec 2017 11:09:05 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41125) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eLtFw-0000Qk-O7 for emacs-devel@gnu.org; Mon, 04 Dec 2017 11:06:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eLtFs-000390-8j for emacs-devel@gnu.org; Mon, 04 Dec 2017 11:06:08 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:56968) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eLtFs-00038k-4u for emacs-devel@gnu.org; Mon, 04 Dec 2017 11:06:04 -0500 Original-Received: from mail-qt0-f176.google.com ([209.85.216.176]:35964) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1eLtFr-0002yD-LY for emacs-devel@gnu.org; Mon, 04 Dec 2017 11:06:03 -0500 Original-Received: by mail-qt0-f176.google.com with SMTP id a16so22067208qtj.3 for ; Mon, 04 Dec 2017 08:06:03 -0800 (PST) X-Gm-Message-State: AKGB3mIgwFvA+JMNvCSZUJ3kYXkU8Tq6r9q9yWAgENSxkkM7BkfLHAzB DBnVeoStfmRtiEfXxoy9KeQoIoZmyu+xAvk28F8= X-Google-Smtp-Source: AGs4zMYHT+Jhu3ti0P41nVuL5xDZhIi99+H8IhUbp5msRSowl1ibzE9d+xCEQJ+OtEeoalCkIfNpOYbCGzhrbBoEVtw= X-Received: by 10.233.222.132 with SMTP id s126mr14134883qkf.145.1512403563132; Mon, 04 Dec 2017 08:06:03 -0800 (PST) Original-Received: by 10.200.55.124 with HTTP; Mon, 4 Dec 2017 08:05:32 -0800 (PST) In-Reply-To: X-Gmail-Original-Message-ID: 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:220699 Archived-At: --94eb2c04363c233e47055f85e5c9 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Dec 4, 2017 at 8:48 AM, Stefan Monnier wrote: > Any objection to installing the patch below into `master`? > > Stefan > > > +(defcustom custom-mimic-plain-elisp nil + "If non-nil, save user settings with the new format. > +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)." > I think there must be a better way to name what you are doing here and to explain it in the doc string. Generally, a reader won't know what 'new format' or 'plain Elisp' mean. See if you can define and clarify them. Also, the mimic term just feels unfamiliar vis-a-vis the rest of the Emacs code base. > + :type 'boolean > + :group 'customize) > =E2=80=8BDon't we typically add '-flag=E2=80=8B' for booleans nowadays? =E2=80=8B=E2=80=8B > + > =E2=80=8B > > + > =E2=80=8B=E2=80=8B > (defcustom custom-mimic-plain-elisp-use-setq nil > + > =E2=80=8B=E2=80=8B > "If non-nil, use `setq' when possible in generated code. > + > =E2=80=8B=E2=80=8B > If nil, `custom-mimic-plain-elisp' will only use `customize-set-variable'= , > =E2=80=8B=E2=80=8B > + > =E2=80=8B=E2=80=8B > which is the more reliable option." > =E2=80=8BHere the documentation is much clearer but the naming could still be improved. What about, `custom-use-setq-flag'? And clarify the contexts where this is used, does it apply to the let bindings that RMS mentioned? > +(defun custom--mimic-plain-elisp (symbol exp requests comment) > =E2=80=8BSince this prints things, its name should mention that. How about, 'custom--print-option-setter'? =E2=80=8B Thanks for developing this and all your great work. Bob --94eb2c04363c233e47055f85e5c9 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Mon, Dec 4, 20= 17 at 8:48 AM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
A= ny objection to installing the patch below into `master`?

=C2=A0 =C2=A0 =C2=A0 =C2=A0 Stefan


+(defcustom custom-mimic-plain-elisp nil
+=C2=A0 "If non-nil, save user settings with th= e new format.
+This new format tries to mimick the code that would be written by hand
+in plain Elisp.=C2=A0 But it relies on `custom-autogenerated-user-set= tings' which
+is a new macro in Emacs-27, so settings saved with this will not wo= rk
+reliably in Emacs<27 (although a backward compatibility trick is used +which should make them work to some extent)."

I think there must be a b= etter way to name what you are doing here
and to explain it in the doc str= ing.=C2=A0 Generally, a reader won't
know what 'new format' or= 'plain Elisp' mean.=C2=A0 See if you can
define and clarify them.= =C2=A0 Also, the mimic term just feels unfamiliar
vis-a-vis the rest of th= e Emacs code base.
=C2=A0
+=C2=A0 :type 'boolean
+=C2=A0 :group 'customize)

=E2=80=8BD= on't we typically add '-flag=E2=80=8B' for booleans nowadays?
=
=E2=80=8B=E2=80=8B
+
=E2=80=8B

+
=E2=80=8B=E2=80=8B
(defcustom custom-mimic-plain-el= isp-use-setq nil
+
=E2=80=8B=E2=80=8B
=C2=A0 "If non-nil, use `setq'= when possible in generated code.
+
=E2=80=8B=E2=80=8B
If nil, `custom-mimic-plain-elisp' = will only use `customize-set-variable',
=E2=80=8B=E2=80=8B
+
=E2=80=8B=E2=80=8B
whic= h is the more reliable option."

=E2=80=8BHe= re the documentation is much clearer but the naming could still
be improve= d.=C2=A0 What about, `custom-use-setq-flag'?=C2=A0 And clarify
the con= texts where this is used, does it apply to the let bindings
that RMS menti= oned?


+(defun custom--mimic-plain-elisp (symbol exp requests comment)

=E2=80=8BSince this prints things, its name should mention = that.
How about, 'custom--print-option-setter'?
=E2=80=8B
Thanks= for developing this and all your great work.

Bob

<= /div> --94eb2c04363c233e47055f85e5c9--