Hide Emacs's Customize

July 2021

If you don't actively use Emacs's customize functionality, it can be frustating when Emacs changes the custom-set-variables block in your init file. For example, when version controlling your init file, you have to skip over these diffs.

So, instead of letting customize make changes to your init file, we can redirect it elsewhere.

(setq custom-file "~/.emacs.d/custom.el")
(when (file-exists-p custom-file)
  (load custom-file))

Because none of your other config will go there, it can be safely added to your version control's ignore file. Even though it won't bother your VCS, it will still be loaded by Emacs, on the off chance you want anything set by customize.

Personally, I prefer to not use customize at all, because changes in it pop up at what appear to be random times. In addition, I often want to annotate or group my configuration, which is harder to do with customize. So when I make changes to my Emacs config, I prefer to do it in Lisp code in my init file.

Or, if you're lawful evil, you could set the custom-file variable with M-x customize.

If you want to hear when I publish more, sign up for my mailing list!

    previous

    < !!Con 2021: Making Music! In Emacs?!
    tag: emacs

    next

    Have Emacs questions? Ask emacs! >