.dir-locals file
A file that sets Emacs variables when editing the files in the containing directory or any of its subdirectories recursively.
The file contains a list of pairs in the form
(PAIR...)
where each PAIR either customizes a given major mode in any subdirectory
(MAJOR-MODE . ((VARIABLE-NAME . VARIABLE-VALUE)...))
or it customizes a given major mode in a specific subdirectory
(SUBDIRECTORY . ((MAJOR-MODE . ((VARIABLE-NAME . VARIABLE-VALUE)...))...))
Two common special cases exist:
- If the
MAJOR-MODEkey equalsnil, then thePAIRapplies to all major modes. - If the
VARIABLE-NAMEkey equalseval, then theVARIABLE-VALUEevaluates as executable code.
Explore!
Write a .dir-locals file that makes the project-compile command execute
Make in the core subdirectory for all files in that subdirectory.
(("core" . ((nil . ((compile-command . "make -C core "))))))