Directory-local variables with Emacs 23

If you manage different projects, it can be useful to define some Emacs variables local to the directory tree you are in. For example, I have different email addresses for different software projects, and I want the ChangeLog entry to show the email address for all software within the project directory. In the past, I used dirvars.el from the emacs-goodies package, but this has now been superseeded by dir-locals.el which is also upstream in EmacsĀ 23. Unfortunately, the documentation in the cloud for this tiny little helper is out of date. This is how it works in EmacsĀ 23 today:

  1. Activate dir-locals-mode by adding to your .emacs file:



  2. In any directory you want to customize variables, create an .emacs-locals file with a block like this:

     Local variables:
     add-log-mailing-address: ""