GNU bug report logs - #43919
27.1.50; Customize save may add (sort-fold-case t t)

Previous Next

Package: emacs;

Reported by: Teemu Likonen <tlikonen <at> iki.fi>

Date: Sun, 11 Oct 2020 05:55:02 UTC

Severity: minor

Tags: fixed, patch

Found in version 27.1.50

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 43919 in the body.
You can then email your comments to 43919 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#43919; Package emacs. (Sun, 11 Oct 2020 05:55:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Teemu Likonen <tlikonen <at> iki.fi>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 11 Oct 2020 05:55:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Teemu Likonen <tlikonen <at> iki.fi>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.1.50; Customize save may add (sort-fold-case t t)
Date: Sun, 11 Oct 2020 08:54:08 +0300
[Message part 1 (text/plain, inline)]
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.

[.emacs.el (application/emacs-lisp, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43919; Package emacs. (Sun, 11 Oct 2020 13:06:02 GMT) Full text and rfc822 format available.

Message #8 received at 43919 <at> debbugs.gnu.org (full text, mbox):

From: Mauro Aranda <maurooaranda <at> gmail.com>
To: Teemu Likonen <tlikonen <at> iki.fi>
Cc: 43919 <at> debbugs.gnu.org
Subject: Re: bug#43919: 27.1.50; Customize save may add (sort-fold-case t t)
Date: Sun, 11 Oct 2020 10:04:59 -0300
[Message part 1 (text/plain, inline)]
Teemu Likonen <tlikonen <at> iki.fi> 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.
[Message part 2 (text/html, inline)]
[0001-Don-t-bind-sort-fold-case-when-saving-the-custom-fil.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43919; Package emacs. (Tue, 13 Oct 2020 01:33:01 GMT) Full text and rfc822 format available.

Message #11 received at 43919 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Mauro Aranda <maurooaranda <at> gmail.com>
Cc: 43919 <at> debbugs.gnu.org, Teemu Likonen <tlikonen <at> iki.fi>
Subject: Re: bug#43919: 27.1.50; Customize save may add (sort-fold-case t t)
Date: Tue, 13 Oct 2020 03:32:30 +0200
Mauro Aranda <maurooaranda <at> gmail.com> writes:

> So, while the behavior observed is harmless, I propose to install the
> attached patch.

Thanks; applied to Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 13 Oct 2020 01:33:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 43919 <at> debbugs.gnu.org and Teemu Likonen <tlikonen <at> iki.fi> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 13 Oct 2020 01:33:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 10 Nov 2020 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 221 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.