help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Eval elisp file automatically


From: Andrea Crotti
Subject: Re: Eval elisp file automatically
Date: Tue, 08 Feb 2011 15:54:33 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (darwin)

Tim X <address@hidden> writes:
>
> Emacs does support .dir-locals, which provides functionality similar to
> file variables, but at the directory level. See the section on
> Per-Directory local variables in the manual. However, your request seems
> slightly misguided to me. I'm not trying to be rude, but do wonder what
> you feel this will achieve or what problem will it address?
>
> My suspicion is there is a either a better solution or you are concerned
> about a non-problem for elisp or I'm just not understanding what you are
> trying to do. 
>
> The standard ways to address the function issue is to use autoloads or
> provide/require, which you either put in a file or possibly a load hook
> so that the functions are only loaded when you load some other mode etc. 
>
> Your reference to restoring default values sounds like you may be
> talking about buffer local variables, but I'm not sure. These variables
> are like other variables, except when you modify them, thos
> modifications are local to the buffer in which it occured. IN this way,
> the variables sort of have a default 'global' value and a local value.
> Any reference made to the variable outside the buffer that has set it as
> a local variable will see the global (default) value. Once you set that
> variable to a new value, that new value will be seen by code running in
> that buffer, but other buffers (who have not set their own local copy)
> will see the global value.
>
> Normally, you just don't bother undefining functions or variables. The
> effort it takes is not worth the resources saved. 
>
>
> Tim

After some time I came back and saw how dir local variables work,
verynice.

So I have this
((nil . 
      ((compile-command . "cd $PAD_DIR && make -j")))
 (c++-mode . (( flymake-mode . t))))

BUT flymake doens't really get activated even if the variable is set to
t.
Isn't there a way to run elisp code somehow, or to modify a hook?

About what I originally asked, well the idea was just that I don't want
to define some functions in case I'm not working on a project.

Now I just load the file with the functions defined and I'm fine.
To make it more neat it would be good to load the file ONLY the first
time that I visit a buffer in that directory, but that's not such a big
deal..




reply via email to

[Prev in Thread] Current Thread [Next in Thread]