The dir-config.el Emacs package automatically loads and evaluates Elisp code from a .dir-config.el
file found in the buffer’s current directory or its closest parent directory. This facilitates adjusting settings or executing functions specific to the directory structure of each buffer.
For instance, you can use the dir-config
package to:
- Configure project-specific settings: Automatically set up environment variables, keybindings, or modes unique to each project.
- Apply directory-specific customizations: Set specific behaviors or preferences for files in different directories, such as enabling or disabling certain minor modes based on security considerations. For example, you might disable linters that execute code in directories where you handle untrusted code.
- Manage multiple environments: Switch between different coding environments or workflows by loading environment-specific configurations.
Installation
To install the dir-config
using straight.el
:
- If you haven’t already done so, add the straight.el bootstrap code to your init file.
- Add the following code to your Emacs init file:
(use-package dir-config
:ensure t
:straight (dir-config
:type git
:host github
:repo "jamescherti/dir-config.el")
:custom
(dir-config-file-names '(".dir-config.el"))
(dir-config-allowed-directories '("~/src" "~/projects"))
:config
(dir-config-mode))
More information about dir-config.el
- More information (usage, frequently asked questions, etc.): dir-config.el @GitHub