[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Eval elisp file automatically
From: |
José A . Romero L . |
Subject: |
Re: Eval elisp file automatically |
Date: |
Mon, 31 Jan 2011 01:35:18 -0800 (PST) |
User-agent: |
G2/1.0 |
On Jan 30, 12:17 pm, Andrea Crotti <andrea.crott...@gmail.com> wrote:
> I have some functions and variables which I only need in one particular
> directory.
>
> Now it would be nice that the first time that I visit a file in that
> subdirectory the file "elisp.el" gets evaluated.
>
> Using find-file-hook might be easy, but How can I make it evaluate only
> once?
(...)
Make your "elisp.el" (provide 'the-stuff-as-an-elisp-feature), then
in find-file-hook if you find you're about to visit a file in that
directory (require 'the-stuff-as-an-elisp-feature).
The (require) mechanism will take care of loading your code only
once.
Cheers,
--
José A. Romero L.
escherdragon at gmail
"We who cut mere stones must always be envisioning cathedrals."
(Quarry worker's creed)