How do I (automatically) set the dictionary (e.g. through an automated call to ispell-change-dictionary
) to a specific language for every file below a particular directory?
Example: I'd prefer my standard directory language to be American English (e.g. by setting (setq ispell-dictionary "en_US-wo_accents")
in my .emacs
file) but I'd like to use British English for all files below (or: under) the directory /home/werner/dissertation/
. And perhaps to Dutch for all files under /home/werner/letters/
.
I am aware of the solution that prescribes to use -*- ispell-dictionary: "english" -*-
at the first line of a file to set the dictionary for that particular file (described at EmacsWiki.org). I'd like to prevent to have to put this line on top of every new file that I make.
You can use something like (but this approach is more useful when you want to make something complex for given files):
or you can specify it in
.dir-locals.el
as described in Emacs Manual - I think, that this will simpler than first approach, something like:for files with specific modes, or
for all files