unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Peter Brett <pb00084@ssclt003.ee.surrey.ac.uk>
To: help-gnu-emacs@gnu.org
Subject: Re: directory specific configuration
Date: Wed, 22 Jul 2009 08:13:02 +0100	[thread overview]
Message-ID: <we1mmy6xmbr5.fsf@ssclt003.ee.surrey.ac.uk> (raw)
In-Reply-To: mailman.2919.1248191311.2239.help-gnu-emacs@gnu.org

giampi <giampisalvi@gmail.com> writes:

> In a perfect world, at least IMHO, emacs would read by default a local
> .emacs file, if existent, on opening any file. All the configurations would
> therefore be local to that directory. I'm not sure if this would slow down
> opening a file.

Would something like this work (in your main .emacs file)?

(add-hook 'find-file-hook
          (function (lambda ()
                            ; Logic for loading directory-specific
                            ; .emacs file goes here
                            )))

You'd probably need to define a directory-local variable in order to
check if you've already loaded the current directory's config this
session.  Also, don't forget that there is a security risk associated
with blindly running elisp code from anywhere on your disk; consider
putting a y-or-n-p in there somewhere.

                               Peter

-- 
Peter Brett <peter@peter-b.co.uk>
Remote Sensing Research Group
Surrey Space Centre


  parent reply	other threads:[~2009-07-22  7:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.2911.1248187239.2239.help-gnu-emacs@gnu.org>
2009-07-21 15:16 ` directory specific configuration Pascal J. Bourguignon
2009-07-21 15:27 ` Dmitry Dzhus
2009-07-21 15:48   ` giampi
     [not found]   ` <mailman.2919.1248191311.2239.help-gnu-emacs@gnu.org>
2009-07-22  7:13     ` Peter Brett [this message]
     [not found] ` <mailman.2916.1248190162.2239.help-gnu-emacs@gnu.org>
2009-07-22  8:58   ` Pascal J. Bourguignon
2009-07-21 10:30 giampi
2009-07-21 15:02 ` Thierry Volpiatto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=we1mmy6xmbr5.fsf@ssclt003.ee.surrey.ac.uk \
    --to=pb00084@ssclt003.ee.surrey.ac.uk \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).