4

On a fresh install of emacs, I loaded my personal init files with all my custom lisp code. Then I changed one setting using the Customize interface and saved my changes. But in the custom.el file, Customize saved not just that one change, but all non default states. So now I have a custom.el file filled with information that's redundant with my own personal init file. This makes it tedious to look through my custom.el file to see settings I've changed.

Is this default behavior? Is there any way to direct Customize to save only the changes I make through the Customize interface?

  • How are you setting things in your init file? Are you using e.g. setq, or are you using customize-set-value? Also, how did you save your changes through the Customize interface? Did you change one setting and use Save for Future Sessions, or something else? – glucas Aug 26 '15 at 18:55
  • My init file contains both setq and custom-set-variables. In Customize, I use C-x C-s Save all settings in buffer? y. – incandescentman Aug 26 '15 at 18:57
  • Do you happen to call load-theme? I was just tracking down an issue where customizations made to the current session before loading a theme end up getting saved to my custom-file. – glucas Aug 26 '15 at 19:05
  • 1
    Just curious, but is there some reason you prefer using setq and customize-set-value in your init files? I personally prefer to have as much as possible set by customize in custom.el. – Trebor Rude Aug 26 '15 at 19:33
  • 2
    +1 for @TreborRude's comment. Let Customize manage variable and face type-checking, initialization, and update trigger actions. Make Customize keep all of the settings it manages in the value of variable custom-file -- a separate file from your init file. (Anything else is silly, IMO.) – Drew Aug 26 '15 at 20:03
1

I have seen similar behavior when using load-theme. I'm not yet sure if this is an Emacs bug.

The behavior I see is as follows:

  • Start Emacs, and customize one or more variables for the current session. I've tried this using customize-set-variable in my init file, as well as using the Easy Customization interface and Set for Current Session.
  • Load a theme.
  • Customize another option and this time Save for Future Sessions.

The result of this sequence is that all the options that I intended to be set only for the current session get written out to the custom file. The act of loading a theme somehow marks them to be saved. You can test this by loading your theme before making other customizations.

This strikes me as wrong, though I am not very familiar with the Emacs theme mechanism. I intend to verify this in a clean environment and file an Emacs bug.

Update

OK, I can reproduce this with a clean environment. Since this issue involves saving customizations you cannot test with emacs -Q (which disables saving changes), so I tested by starting Emacs 24.4 with an empty user home directory.

Then:

  • M-x customize-variable user-full-name; set some value; Set for Current Session.
  • M-x load-theme deeper-blue
  • M-x customize-variable user-mail-address; set some value; Save for Future Sessions. This results in a new .emacs file that includes both user-full-name and user-mail-address, even though the name should have only been set for the current session.

Submitted bug #21355.

  • I guess it's hard to tell what's causing it. I'm trying out Spacemacs (hence the fresh install). Spacemacs loads a color theme by default when Emacs stars. Just now I tried wiping out the customizations file, restarting, using Customize to change a font face, then save, and... I got another fully populated customizations file. – incandescentman Aug 26 '15 at 20:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.