Disable warning about emacs.d in load path

AdrieanKhisbe picture AdrieanKhisbe · Jul 16, 2014 · Viewed 10.7k times · Source

In latest version of ̀emacs ( from 24.3.50 snapshot) there is a warning at startup when .emacs.d happens to be in the load path.

Warning (initialization): Your `load-path' seems to contain
your `.emacs.d' directory: ~/.emacs.d/
This is likely to cause problems...
Consider using a subdirectory instead, e.g.: /home/adriean/.emacs.d/lisp

Is there a way to disable just this warning?

(since I wanna keep my emacs.d in the load path, for now as a quick brute hack I went for (setq warning-minimum-level :error), but I would prefer to get rid of this as soon as possible)

Answer

phils picture phils · Jul 17, 2014

Don't disable the warning. It's there for a good reason: ~/.emacs.d shouldn't be in your load-path.

This is because Emacs writes files to this directory, and therefore it's possible (there are existing cases) for those files to conflict with the names of elisp libraries. If you have this directory in your load path, and you have such a name clash, then Emacs will attempt to load the wrong file if that library is required.

Just change your configuration. It's trivial to move the elisp libraries you've placed in that directory into a sub-directory, and then update the code which was adding ~/.emacs.d to your load-path, so that it adds the new sub-directory instead:

(add-to-list 'load-path (expand-file-name "~/.emacs.d/lisp"))