From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andrea Crotti Newsgroups: gmane.emacs.help Subject: Re: Eval elisp file automatically Date: Tue, 08 Feb 2011 15:54:33 +0100 Message-ID: References: <8739oaboss.fsf@puma.rapttech.com.au> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1297176935 20386 80.91.229.12 (8 Feb 2011 14:55:35 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 8 Feb 2011 14:55:35 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Feb 08 15:55:30 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PmoyT-0002z8-KT for geh-help-gnu-emacs@m.gmane.org; Tue, 08 Feb 2011 15:55:25 +0100 Original-Received: from localhost ([127.0.0.1]:56632 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PmoyS-0001iA-Vr for geh-help-gnu-emacs@m.gmane.org; Tue, 08 Feb 2011 09:55:25 -0500 Original-Received: from [140.186.70.92] (port=59807 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pmoy2-0001h5-Rt for help-gnu-emacs@gnu.org; Tue, 08 Feb 2011 09:54:59 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pmoy1-00032I-Do for help-gnu-emacs@gnu.org; Tue, 08 Feb 2011 09:54:58 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]:59800) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pmoy1-000322-3W for help-gnu-emacs@gnu.org; Tue, 08 Feb 2011 09:54:57 -0500 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Pmoxy-0002ZU-Gv for help-gnu-emacs@gnu.org; Tue, 08 Feb 2011 15:54:54 +0100 Original-Received: from 95-238.eduroam.rwth-aachen.de ([134.61.95.238]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 08 Feb 2011 15:54:54 +0100 Original-Received: from andrea.crotti.0 by 95-238.eduroam.rwth-aachen.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 08 Feb 2011 15:54:54 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 52 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 95-238.eduroam.rwth-aachen.de User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (darwin) Cancel-Lock: sha1:IM5m/uplkPDSfiry7LG/uXS0I0Y= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:79032 Archived-At: Tim X 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..