Location of emacs config
Collected in Emacs
After a fresh emacs installation, I always spent a few minutes why emacs wouldn't pick up my config from ~/.config/emacs/init.el
.
I prefer to keep user configuration inside the standard XDG_CONFIG_HOME
, which typically points to ~/.config/
. Emacs also supports XDG_CONFIG_HOME
, but as the last entry in its list of preferred locations, where it looks for init.el
.
The list goes in the order: ~/.emacs.el
, ~/.emacs
, or ~/.emacs.d/init.el
, and then ~/.config/emacs/init.el
.
Emacs manual also says the following:
Note also that if neither the XDG location nor
~/.emacs.d
exist, then Emacs will create~/.emacs.d
(and therefore use it during subsequent invocations).
Now, the XDG location, i.e., ~/.config/emacs/
wouldn't typically exist in a system by default. So emacs would always end up defaulting to ~/.emacs.d/
. In order to make it read the XDG location, I always had to manually delete ~/.emacs.d/
first.
So much hassle on every new system or after a fresh emacs installation. So I now just stow
my emacs dotfiles to ~/.emacs.d
.
Written by Jayesh Bhoot