Basically I would like to have (custom-set-variables ...) in a seperate file and for me to load that file.

This is just for the purpose of organisation of my init file.

How can I change the default location of custom-set-variables?

  • 3
    Good question. Not enough users make use of custom-file, IMO. The Emacs doc should make it more prominent, and even provide for it being used by default, rather than letting Customize pollute the init file.
    – Drew
    Apr 3, 2016 at 16:01

2 Answers 2


Set the custom-file variable in your init file.

C-hv custom-file RET

  • 1
    And note that although this is a user option, you probably do not want to count on setting it only using Customize, i.e., setting it in your `custom-file'. ;-)
    – Drew
    Apr 3, 2016 at 16:00

Example of exact text you may want to place in your init.el:

(setq custom-file (concat user-emacs-directory "custom.el"))
(load custom-file 'noerror)
  • 2
    I think this is the better answer here.
    – vise
    May 31, 2020 at 23:00
  • Thank you. I do not know why sometimes emacs guides leave out examples and exact text. I think it makes it harder for beginners. Oct 17, 2023 at 2:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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