From: Mauro Aranda <maurooaranda@gmail.com>
To: Teemu Likonen <tlikonen@iki.fi>
Cc: 43919@debbugs.gnu.org
Subject: bug#43919: 27.1.50; Customize save may add (sort-fold-case t t)
Date: Sun, 11 Oct 2020 10:04:59 -0300 [thread overview]
Message-ID: <CABczVwckYFSGDd+b2-sNKN41buzyOo9ovB6m49WzVPu7Xh_HJg@mail.gmail.com> (raw)
In-Reply-To: <878scd48an.fsf@iki.fi>
[-- Attachment #1.1: Type: text/plain, Size: 2297 bytes --]
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 #1.2: Type: text/html, Size: 2841 bytes --]
[-- Attachment #2: 0001-Don-t-bind-sort-fold-case-when-saving-the-custom-fil.patch --]
[-- Type: text/x-patch, Size: 1571 bytes --]
From a152c5096caa23846af3822a465aec6025ba46c6 Mon Sep 17 00:00:00 2001
From: Mauro Aranda <maurooaranda@gmail.com>
Date: Sun, 11 Oct 2020 09:44:40 -0300
Subject: [PATCH] Don't bind sort-fold-case when saving the custom-file
* lisp/cus-edit.el (custom-save-variables, custom-save-faces): These
functions sort a list, not buffer text, so they don't need
to use sort-fold-case at all. Remove the let-binding for
sort-fold-case. (Bug#43919)
---
lisp/cus-edit.el | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index 9c5d89f89f..3c93753495 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -4681,15 +4681,12 @@ custom-save-delete
(setq pos (line-beginning-position))))
(goto-char pos)))))
-(defvar sort-fold-case) ; defined in sort.el
-
(defun custom-save-variables ()
"Save all customized variables in `custom-file'."
(save-excursion
(custom-save-delete 'custom-set-variables)
(let ((standard-output (current-buffer))
- (saved-list (make-list 1 0))
- sort-fold-case)
+ (saved-list (make-list 1 0)))
;; First create a sorted list of saved variables.
(mapatoms
(lambda (symbol)
@@ -4771,8 +4768,7 @@ custom-save-faces
(custom-save-delete 'custom-reset-faces)
(custom-save-delete 'custom-set-faces)
(let ((standard-output (current-buffer))
- (saved-list (make-list 1 0))
- sort-fold-case)
+ (saved-list (make-list 1 0)))
;; First create a sorted list of saved faces.
(mapatoms
(lambda (symbol)
--
2.28.0
next prev parent reply other threads:[~2020-10-11 13:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-11 5:54 bug#43919: 27.1.50; Customize save may add (sort-fold-case t t) Teemu Likonen
2020-10-11 13:04 ` Mauro Aranda [this message]
2020-10-13 1:32 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CABczVwckYFSGDd+b2-sNKN41buzyOo9ovB6m49WzVPu7Xh_HJg@mail.gmail.com \
--to=maurooaranda@gmail.com \
--cc=43919@debbugs.gnu.org \
--cc=tlikonen@iki.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.