Subject: bug#18633: 24.3; `customize-save-customized' should be handled as a transaction

From: Matúš Goljer <[email-masked]>
Date: Sun, 05 Oct 2014 16:18:00 +0200

If `customize-save-customized' is issued (through M-x or any other way,
such as C-x C-s in customize buffer), and during the run of the function
"exit" is called (e.g. using C-g), the routine writes garbage into the
`custom-set-variables' form in `custom-file'.

We should first construct the form in a temporary buffer and then write
it at once into the output file.  Another (simpler) solution is to use
`atomic-change-group' from subr.el

Had I not kept the file under git, I would've lost most of my settings.
It seems like a good idea to handle a critical operation like this
atomically.

Cheers.

-- 
Best regards,
  Matúš Goljer