Subject: Re: bug#63891: 29.0.91; customize-save-variable should not save all variables if a custom file exists

From: Michael Albinus <[email-masked]>
Date: Tue, 06 Jun 2023 14:36:14 +0200

Eli Zaretskii <[email-masked]> writes:

Hi Eli,

>> >> No it does not saves only one variable to file, it only saves one variable to file if you have only modified
>> >> one variable.
>> >
>> > That's not what I see.  I've modified several options using the
>> > menu-bar's Options menu, then typed
>> >
>> >   M-x customize-save-variable RET truncate-lines RET y
>> >
>> > and saw that only truncate-lines was written to the custom file.
>> >
>> > If you see something else, please show a complete recipe that
>> > reproduces the behavior you see.
>>
>> custom-set-variables
>
> That's a different function.  I was talking about
> customize-save-variable.

I know. I just wanted to clarify, where the saved-value of other user
options is set.

And customize-save-variable, although invoked with just one variable,
saves *all* variables with a saved-value property, IIUC.

A recipe you have asked for could be

--8<---------------cut here---------------start------------->8---
(defcustom a nil
  "" :type 'boolean)

(defcustom b nil
  "" :type 'boolean)

(defcustom c nil
  "" :type 'boolean)

(custom-set-variables '(a t) '(b t))

;; Nothing happened so far in the init file.

(customize-save-variable 'c t)

;; Your init file contains then

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(a t)
 '(b t)
 '(c t)
 ...)
--8<---------------cut here---------------end--------------->8---

Best regards, Michael.