[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[h-e-w] Re: help-emacs-windows Digest, Vol 7, Issue 8
From: |
David J. Biesack |
Subject: |
[h-e-w] Re: help-emacs-windows Digest, Vol 7, Issue 8 |
Date: |
Wed, 18 Jun 2003 13:16:27 -0400 (EDT) |
> Date: Wed, 18 Jun 2003 09:41:36 -0400
> From: Ben Key <address@hidden>
>
> I am trying to modify Emacs to use a more intelligent method of setting the
> value of compile command.
>
> I have defined a function that calculates the compile command and I am
> trying to get compile to call the function prior to displaying the
> compile-command prompt using defadvice. For some reason it is not working.
> What am I doing wrong?
>
> (defun bk-set-compile-command ()
[snip]
> )
>
> (if (fboundp 'defadvice)
> (progn
> (defadvice compile (before bk-set-compile-command-advice activate)
> (bk-set-compile-command)
> )
> (ad-enable-advice 'compile 'before 'bk-set-compile-command-advice)
> (ad-activate 'compile)
> )
> )
You may find it easier to set compile-command in a mode function or
hook, rather as advice on M-x compile. That way, the correct command is
set when you first visit a file. Also, you can later change the compile
command if you want and your change won't get lost next time you invoke
M-x compile.
i.e. in my jde-mode-hook (JDE is the Java Development Environment
and jde-mode is bound for *.java), I do:
(add-hook 'jde-mode-hook 'jde-mode-hook t)
(defun jde-mode-hook ()
(interactive)
;; snip
(java-set-ant-command)
;; snip
)
(defun java-set-ant-command ()
(interactive)
(setq compile-command "ant -find build.xml"))
--
David J. Biesack SAS Institute Inc.
R&D Java Strategist SAS Campus Drive Cary, NC 27513
(919) 531-7771 http://www.sas.com
- [h-e-w] Re: help-emacs-windows Digest, Vol 7, Issue 8,
David J. Biesack <=