Variable: custom-file
custom-file is a customizable variable defined in cus-edit.el.gz.
Value
nil
Documentation
File used for storing customization information.
The default is nil, which means to use your init file
as specified by user-init-file. If the value is not nil,
it should be an absolute file name.
You can set this option through Custom, if you carefully read the last paragraph below. However, usually it is simpler to write something like the following in your init file:
(setq custom-file "~/.config/emacs-custom.el")
(load custom-file)
Note that both lines are necessary: the first line tells Custom to save all customizations in this file, but does not load it.
When you change this variable outside Custom, look in the
previous custom file (usually your init file) for the
forms (custom-set-variables ...) and (custom-set-faces ...),
and copy them (whichever ones you find) to the new custom file.
This will preserve your existing customizations.
If you save this option using Custom, Custom will write all
currently saved customizations, including the new one for this
option itself, into the file you specify, overwriting any
custom-set-variables and custom-set-faces forms already
present in that file. It will not delete any customizations from
the old custom file. You should do that manually if that is what you
want. You also have to put something like (load "CUSTOM-FILE")
in your init file, where CUSTOM-FILE is the actual name of the
file. Otherwise, Emacs will not load the file when it starts up,
and hence will not set custom-file(var)/custom-file(fun) to that file either.
Source Code
;; Defined in /usr/src/emacs/lisp/cus-edit.el.gz
;;; Reading and writing the custom file.
;;;###autoload
(defcustom custom-file nil
"File used for storing customization information.
The default is nil, which means to use your init file
as specified by `user-init-file'. If the value is not nil,
it should be an absolute file name.
You can set this option through Custom, if you carefully read the
last paragraph below. However, usually it is simpler to write
something like the following in your init file:
(setq custom-file \"~/.config/emacs-custom.el\")
(load custom-file)
Note that both lines are necessary: the first line tells Custom to
save all customizations in this file, but does not load it.
When you change this variable outside Custom, look in the
previous custom file (usually your init file) for the
forms `(custom-set-variables ...)' and `(custom-set-faces ...)',
and copy them (whichever ones you find) to the new custom file.
This will preserve your existing customizations.
If you save this option using Custom, Custom will write all
currently saved customizations, including the new one for this
option itself, into the file you specify, overwriting any
`custom-set-variables' and `custom-set-faces' forms already
present in that file. It will not delete any customizations from
the old custom file. You should do that manually if that is what you
want. You also have to put something like (load \"CUSTOM-FILE\")
in your init file, where CUSTOM-FILE is the actual name of the
file. Otherwise, Emacs will not load the file when it starts up,
and hence will not set `custom-file' to that file either."
:type '(choice (const :tag "Your Emacs init file" nil)
(file :format "%t:%v%d"
:doc
"Please read entire docstring below before setting \
this through Custom.
Click on \"More\" (or position point there and press RETURN)
if only the first line of the docstring is shown."))
:group 'customize)