From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mauro Aranda Newsgroups: gmane.emacs.bugs Subject: bug#43919: 27.1.50; Customize save may add (sort-fold-case t t) Date: Sun, 11 Oct 2020 10:04:59 -0300 Message-ID: References: <878scd48an.fsf@iki.fi> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="000000000000000bc905b164d5aa" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15854"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 43919@debbugs.gnu.org To: Teemu Likonen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Oct 11 15:06:11 2020 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 1kRb3C-0003zE-Kh for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 11 Oct 2020 15:06:10 +0200 Original-Received: from localhost ([::1]:40960 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kRb3B-0001o4-Jq for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 11 Oct 2020 09:06:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34384) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kRb34-0001nu-Sy for bug-gnu-emacs@gnu.org; Sun, 11 Oct 2020 09:06:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56000) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kRb34-00057H-K5 for bug-gnu-emacs@gnu.org; Sun, 11 Oct 2020 09:06:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kRb34-0005Qa-EU for bug-gnu-emacs@gnu.org; Sun, 11 Oct 2020 09:06:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <878scd48an.fsf@iki.fi> Resent-From: Mauro Aranda Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 11 Oct 2020 13:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43919 X-GNU-PR-Package: emacs Original-Received: via spool by 43919-submit@debbugs.gnu.org id=B43919.160242152020809 (code B ref 43919); Sun, 11 Oct 2020 13:06:02 +0000 Original-Received: (at 43919) by debbugs.gnu.org; 11 Oct 2020 13:05:20 +0000 Original-Received: from localhost ([127.0.0.1]:39313 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kRb2N-0005PZ-NU for submit@debbugs.gnu.org; Sun, 11 Oct 2020 09:05:20 -0400 Original-Received: from mail-wr1-f51.google.com ([209.85.221.51]:46127) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kRb2L-0005PG-Pe for 43919@debbugs.gnu.org; Sun, 11 Oct 2020 09:05:18 -0400 Original-Received: by mail-wr1-f51.google.com with SMTP id n6so15509607wrm.13 for <43919@debbugs.gnu.org>; Sun, 11 Oct 2020 06:05:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=xRqSvYCAaq17aFC7r6Bmuytvx835cinxFVbHyJNVfCk=; b=GeI/mF90AZvZfZXOSLN5NwB2obmmfv3idok6tnzSylhpjloDyWh/H903+NjlmwVJ84 TepslY8FYyolNYpKZguXZvrHukIma2kEw/7QGL2HINSYVCUo/lIFlEZsqn/T4k5YI2yW NAwaf8/fc+Ok8r9HQP4OjHTesMoJq5tWBIcpcIehFI81MoQFZVBKi3C6NFVf6DvB6sxP vhp9HytG4/lQ4/KhJ9VWHPoDvnv5WiTtVxxvRuFt9WI7A6ENW3YD/sPPOscf0+8WEpdq CF87ftTNX+Mz3eIWwlOVEVfKgXbYwIc6bajfwkLqA+Sp3nTRIUgh8l2nWAGCf0bjV64a GTfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=xRqSvYCAaq17aFC7r6Bmuytvx835cinxFVbHyJNVfCk=; b=CiRcmW2yWLtugLCZjzbEZovH/MYrFjbWTlYnuSlZWI2+znFbGQWilyxN188Z1wmv9v /fjgVK1ARisfoKoree82QyyO++FVNamDFz3sJ5IWYtq4jxewIsbKcfzFIbYoeW6aZQVf OyHxB+j294YAwCr0Od8iNODSMhdGlMCIqhgvM/D8C/YiBDCFFLiKqjVsotRDmb10JA+E PZpZr3VwCvBa/5Wb+/BAvNKo/Bp7/nSJMFlOZnbWmq4x5nb7B8jFjYyBAeGYo8/3FQH7 d60KRM0wwiyJ8hmNzCs55yJQ4eatsqQpBgBDJUyGFyuCbvuwplNieqkl9GCn1plHeUQ3 YCgA== X-Gm-Message-State: AOAM533XlM086IYoWrHd0KPRtzMpJqkpomKUI/QfhizICWZ8Lq2OcoTa gbecDv2vTJ8/R4TiIhYby8/9AJ4MJDvyZwj43qw= X-Google-Smtp-Source: ABdhPJyODOE8L0s4g4Rc+DR3CrsxB/pgmV/SFnVn/DWjbgJQns8V9DW9SqFuvEBYtSwl1E2O9mPjVPMuZOOQ5pyYyaE= X-Received: by 2002:a5d:4cd1:: with SMTP id c17mr12579558wrt.109.1602421511940; Sun, 11 Oct 2020 06:05:11 -0700 (PDT) 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:190272 Archived-At: --000000000000000bc905b164d5aa Content-Type: multipart/alternative; boundary="000000000000000bc605b164d5a8" --000000000000000bc605b164d5a8 Content-Type: text/plain; charset="UTF-8" Teemu Likonen writes: > This issue shows when initialization file has (custom-set-variables ...) > with sort-fold-case set, like this: > > (custom-set-variables > '(sort-fold-case t)) > > Saving some other variable through the customize interface will add > additional "t" symbol to the sort-fold-case form: > > (custom-set-variables > ;; Other variables... > '(sort-fold-case t t)) > > Some other customize changes change the form back to (sort-fold-case t), > that is, with single "t" symbol. > > Everything seems to be working but this behavior is harmful when Emacs > initialization files are in version control system (like Git) and > sort-fold-case variable keeps changing back and forth. > > You can reproduce the bug with this recipe: > > 1. Create ~/.emacs.el file with the following content (also attached > file). > > (custom-set-variables > '(sort-fold-case t)) > > 2. Start Emacs. > > 3. Use customize interface to change and save some other variable, for > example: > > M-x customize-variable RET show-trailing-whitespace RET > > Change variable's value to "t" and save it "for future sessions". > > 4. Now the custom-set-variables form in ~/.emacs.el file looks like > this: > > (custom-set-variables > '(show-trailing-whitespace t) > '(sort-fold-case t t)) > > See the added "t" in sort-fold-case. The second t is the NOW member, as described in custom-theme-set-variables. That means something makes Custom think that the customization should be installed right away. So that would not be a bug, if there were good reasons for it. In the recipe, step 3, sort.el hasn't been loaded in the session, so custom doesn't know yet that sort-fold-case is a custom option (i.e., (custom-variable-p sort-fold-case) ==> nil). And since custom-save-variables binds sort-fold-case to nil, the following yields t: (boundp sort-fold-case), so Custom thinks it has to add the NOW member to the list setting of sort-fold-case. But the sort-fold-case bindings seems unnecessary, since Custom doesn't use a single sort.el function, it only uses `sort' to sort the list of options to save. So, while the behavior observed is harmless, I propose to install the attached patch. --000000000000000bc605b164d5a8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Teemu Likonen <tliko= nen@iki.fi> writes:

> This issue shows when initialization= file has (custom-set-variables ...)
> with sort-fold-case set, like = this:
>
> =C2=A0 =C2=A0 (custom-set-variables
> =C2=A0 = =C2=A0 =C2=A0'(sort-fold-case t))
>
> Saving some other var= iable through the customize interface will add
> additional "t&q= uot; symbol to the sort-fold-case form:
>
> =C2=A0 =C2=A0 (cust= om-set-variables
> =C2=A0 =C2=A0 =C2=A0;; Other variables...
> = =C2=A0 =C2=A0 =C2=A0'(sort-fold-case t t))
>
> Some other c= ustomize changes change the form back to (sort-fold-case t),
> that i= s, with single "t" symbol.
>
> Everything seems to be= working but this behavior is harmful when Emacs
> initialization fil= es are in version control system (like Git) and
> sort-fold-case vari= able keeps changing back and forth.
>
> You can reproduce the b= ug with this recipe:
>
> =C2=A01. Create ~/.emacs.el file with = the following content (also attached
> =C2=A0 =C2=A0 file).
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 (custom-set-variables
> =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0'(sort-fold-case t))
>
> =C2=A02. S= tart Emacs.
>
> =C2=A03. Use customize interface to change and = save some other variable, for
> =C2=A0 =C2=A0 example:
>
>= ; =C2=A0 =C2=A0 =C2=A0 =C2=A0 M-x customize-variable RET show-trailing-whit= espace RET
>
> =C2=A0 =C2=A0 Change variable's value to &qu= ot;t" and save it "for future sessions".
>
> =C2= =A04. Now the custom-set-variables form in ~/.emacs.el file looks like
&= gt; =C2=A0 =C2=A0 this:
>
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 (custom= -set-variables
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0'(show-trailin= g-whitespace t)
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0'(sort-fold-c= ase t t))
>
> =C2=A0 =C2=A0 See the added "t" in sort= -fold-case.

The second t is the NOW member, as described in
custo= m-theme-set-variables.=C2=A0 That means something makes Custom think
tha= t the customization should be installed right away.=C2=A0 So that would
= not be a bug, if there were good reasons for it.

In the recipe, step= 3, sort.el hasn't been loaded in the session, so
custom doesn't= know yet that sort-fold-case is a custom option (i.e.,
(custom-variable= -p sort-fold-case) =3D=3D> nil).=C2=A0 And since
custom-save-variable= s binds sort-fold-case to nil, the following yields
t: (boundp sort-fold= -case), so Custom thinks it has to add the NOW
member to the list settin= g of sort-fold-case.=C2=A0 But the sort-fold-case
bindings seems unneces= sary, since Custom doesn't use a single sort.el
function, it only us= es `sort' to sort the list of options to save.

So, while the beh= avior observed is harmless, I propose to install the
attached patch.
=
--000000000000000bc605b164d5a8-- --000000000000000bc905b164d5aa Content-Type: text/x-patch; charset="US-ASCII"; name="0001-Don-t-bind-sort-fold-case-when-saving-the-custom-fil.patch" Content-Disposition: attachment; filename="0001-Don-t-bind-sort-fold-case-when-saving-the-custom-fil.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_kg54bkmg0 RnJvbSBhMTUyYzUwOTZjYWEyMzg0NmFmMzgyMmE0NjVhZWM2MDI1YmE0NmM2IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBNYXVybyBBcmFuZGEgPG1hdXJvb2FyYW5kYUBnbWFpbC5jb20+ CkRhdGU6IFN1biwgMTEgT2N0IDIwMjAgMDk6NDQ6NDAgLTAzMDAKU3ViamVjdDogW1BBVENIXSBE b24ndCBiaW5kIHNvcnQtZm9sZC1jYXNlIHdoZW4gc2F2aW5nIHRoZSBjdXN0b20tZmlsZQoKKiBs aXNwL2N1cy1lZGl0LmVsIChjdXN0b20tc2F2ZS12YXJpYWJsZXMsIGN1c3RvbS1zYXZlLWZhY2Vz KTogVGhlc2UKZnVuY3Rpb25zIHNvcnQgYSBsaXN0LCBub3QgYnVmZmVyIHRleHQsIHNvIHRoZXkg ZG9uJ3QgbmVlZAp0byB1c2Ugc29ydC1mb2xkLWNhc2UgYXQgYWxsLiAgUmVtb3ZlIHRoZSBsZXQt YmluZGluZyBmb3IKc29yd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