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

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

Re: Per-directory customizations?


From: Roy Smith
Subject: Re: Per-directory customizations?
Date: Fri, 30 Apr 2004 15:27:05 -0400
User-agent: MT-NewsWatcher/3.4 (PPC Mac OS X)

In article <address@hidden>,
 Kevin Rodgers <address@hidden> wrote:

> [Please don't top-post.]
> 
> Kin Cho wrote:
>  > Roy Smith <address@hidden> writes:
>  >>Is there any way to do customizations on a per-directory basis?
>  >>
>  >>For example, I've got java project which lives in ~/dev/foo.  Anytime I
>  >>run M-X compile anywhere inside the ~/dev/foo hierarchy, I want the
>  >>command run to be "cd ~/dev/foo; ant".  I don't want to just set
>  >>compile-command in my .emacs file, because the right command varies
>  >>depending on which project (i.e. directory subtree) I'm in.
>  >>
>  >>Is there any way to do this?  I'm running GNU Emacs 21.2.1.
>  >
>  > I do something similar, with defadvice of compile-internal, and
>  > setq compile-command depending on default-directory.
> 
> Why not set compile-command in the mode hook, as suggested in it's doc
> string:
> 
> (add-hook 'java-mode-hook
>         (lambda ()
>           (when (string-match "\\`~/dev/foo/" default-directory)
>             (set (make-local-variable 'compile-command)
>                  "cd ~/dev/foo; ant"))))

The problem there, is it only works for java files.  I've got all sorts 
of files in my project directory tree (html, css, jsp, etc, etc).  I 
want the compile command tied to the directory tree, not the file type.


reply via email to

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