Moving the .emacs file and the .emacs.d/ directory? reddit / emacs ---------------------------------------------------------------------- Reikimann · 2022-02-01 16:37 Sup guys! I just installed Emacs and I'm really excited to get to know this program. However, I like to keep my $HOME directory clean. So I was wondering if I could move these folders/files to somewhere else (I use arch, btw). I have tried to find this information elsewhere, but I can't seem to locate it. Thx ---------------------------------------------------------------------- chiraagnataraj · 2022-02-01 16:51 I moved it to `~/.config` and then setup a symlink from `~/.emacs.d` to `~/.config/emacs.d`. ---------------------------------------------------------------------- plastashite · 2022-02-01 17:00 Don't symlink. Move it explicitly. Emacs will then pick up the config directory automatically. (I just read about this when installing chemacs2 from github) ie Emacs 27+ honors the XDG standard. ---------------------------------------------------------------------- rpluim · 2022-02-01 17:09 Strictly speaking emacs will look in "$XDG_CONFIG_HOME/emacs" or "~/.config/emacs" for init.el ---------------------------------------------------------------------- _viz_ · 2022-02-01 17:28 From NEWS.27, ** Emacs can now use the XDG convention for init files. The 'XDG_CONFIG_HOME' environment variable (which defaults to "~/.config") specifies the XDG configuration parent directory. Emacs checks for "init.el" and other configuration files inside the "emacs" subdirectory of 'XDG_CONFIG_HOME', i.e. "$XDG_CONFIG_HOME/emacs/init.el" However, Emacs will still initially look for init files in their traditional locations if "~/.emacs.d" or "~/.emacs" exist, even if "$XDG_CONFIG_HOME/emacs" also exists. This means that you must delete or rename any existing "~/.emacs.d" and "~/.emacs" to enable use of the XDG directory. If "~/.emacs.d" does not exist, and Emacs has decided to use it (i.e. "$XDG_CONFIG_HOME/emacs" does not exist), Emacs will create it. Emacs will never create "$XDG_CONFIG_HOME/emacs". Whichever directory Emacs decides to use, it will set 'user-emacs-directory' to point to it. ---------------------------------------------------------------------- Reikimann · 2022-02-01 17:48 Does this mean I can do this: mv .emacs.d .emacs ~/.config/emacs/ ? And what happens when you install a package? ---------------------------------------------------------------------- chiraagnataraj · 2022-02-01 18:05 Ah, cool. When I did this originally, Emacs would not have picked it up and I haven't bothered removing the symlink since. ---------------------------------------------------------------------- nv-elisp · 2022-02-01 18:23 > (I use arch, btw) https://wiki.archlinux.org/title/emacs#Customization ---------------------------------------------------------------------- Lalylulelo · 2022-02-01 21:17 If you have any hardlink to \~/.emacs.d in your init file, I guess it will be a mess. But if you don't, the emacs base directory is stored in user-emacs-directory and this variable is used as a prefix for everything. I manage several configurations in an \~/.emacs-conf/ directory, and my main one is well recognized in \~/.emacs- conf/default. I let any better-informed emacs user correct me if I'm wrong. ---------------------------------------------------------------------- akirakom · 2022-02-02 05:17 You have to rename `.emacs` to `init.el` if you put it in `user-emacs- directory` (`~/.emacs` or `~/.config/emacs`).