I have a custom config for a project which I would like to load whenever emacs is started from project's root directory. The custom config lies in
path/to/project/emacs.d/custom-init.el. I have also added the following code to
.dir-locals.el so the the loading is automatically added to the users
((nil . ((eval . ((lambda () (let ((init-file-path (expand-file-name "emacs.d/custom-init.el" default-directory))) (when (file-exists-p init-file-path) (load init-file-path) (require 'project-name)))))))))
The problem is the custom config only gets loaded when I enter for example dired in a subfolder of the project and not just when I start emacs from the root directory of the project.