[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: directory specific configuration
From: |
Pascal J. Bourguignon |
Subject: |
Re: directory specific configuration |
Date: |
Tue, 21 Jul 2009 17:16:24 +0200 |
User-agent: |
Gnus/5.101 (Gnus v5.10.10) Emacs/22.2 (gnu/linux) |
giampi <giampisalvi@gmail.com> writes:
> Hi all,
> short version of the question: is there a way to make emacs read (besides
> the local ~/.emacs file) also a directory specific .emacs file, in case that
> file exists?
>
> long version: I use emacs to write latex files. I often use different
> languages and therefore would like to use different dictionaries in ispell.
> I also often split the document in several tex files, so, every time I have
> to set the dictionary manually for each file. Each document is in a
> different directory, so it would be practical for me to have an automatic
> way to always start emacs with the right dictionary depending on the
> directory I run from (or, better, depending on the location of the file I
> open).
>
> I bet this would require just a few lines of lisp in ~/.emacs that do:
> 1) get directory of the file I'm opening
> 2) check if a .emacs file exists for that directory
> 3) source the .emacs file
> Unfortunately I'm no lisp programmer, so any help would be appreciated.
It would be better to name those files without a prefix dot. It would
avoid bad surprises. So assuming that you call those files: config.el
you can easily load these files easily:
M-x load-file RET ~/some/dir/config.el RET
Actually, if you have a latex file open in that directory, then the
default directory is already that of the latex file where you have
your config.el, so you can just type:
M-x load-file RET config.el RET
If you only want to change the dictionnary for each latex document,
you could do that with File Variables. (info "(emacs)File Variables")
Put in a comment at the end of the file:
Local Variables:
eval: (ispell-change-dictionary "your-specific-dictionary")
End:
and then when loading again that file, the expression will be
evaluated, and you'll be set.
--
__Pascal Bourguignon__