Store customization file in separate file in Emacs

The built-in customization UI in Emacs is an unorganized mess of elisp code that is appended at the bottom of your init file.

By setting the custom-file variable, you can keep those automatically generated customizations in a separate file. Put this in your Emacs init:

 
(setq custom-file "~/.emacs.d/custom.el")
(load custom-file 'noerror)
 

The first line tells Custom to save all customizations in the file, but does not load it. The 'noerror argument passed to load prevents errors if the file doesn’t exist. If you had existing customizations in your init file, be sure to copy them to the new custom file.