bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Mauro Aranda
Subject: bug#43919: 27.1.50; Customize save may add (sort-fold-case t t)
Date: Sun, 11 Oct 2020 10:04:59 -0300

Teemu Likonen <tlikonen@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.

Attachment: 0001-Don-t-bind-sort-fold-case-when-saving-the-custom-fil.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]