1

I'm looking to load a local config file for emacs when I "M-x: cd" into a new directory. Project specific settings. I'm wondering how'd I'd set this up in my init.el. I've got a local config setup like

(if (file-exists-p "~/.emacs.d/local.el") (load-file "~/.emacs.d/local.el"))

0

2 Answers 2

1

Your question isn't entirely clear, but one very useful technique for project-specific settings is to use a .dir-locals.el file:

Sometimes, you may wish to define the same set of local variables to all the files in a certain directory and its subdirectories, such as the directory tree of a large software project. This can be accomplished with directory-local variables.

Here's an example of a .dir-locals.el file:

((nil . ((indent-tabs-mode . t) (fill-column . 80))) (c-mode . ((c-file-style . "BSD") (subdirs . nil))) ("src/imported" . ((nil . ((change-log-default-name . "ChangeLog.local")))))) 
Sign up to request clarification or add additional context in comments.

Comments

0

It's not very clear to me what you're asking, but if you want to do something additional whenever Emacs function (command) cd is invoked then just advise it.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.