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

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

Re: NEWBIE: different compile-commands for different fiel types (cc, xm


From: Kevin Rodgers
Subject: Re: NEWBIE: different compile-commands for different fiel types (cc, xml)
Date: Thu, 28 Oct 2004 10:54:18 -0600
User-agent: Mozilla Thunderbird 0.8 (X11/20040916)

Johannes Kastl wrote:
> The background is that I am compiling .cc files, and also .xml files at
> the moment. And I am proud that I got it working to specify my own
> complie-command in the settings. But it is only one, for the other
> filetype I have to change it everytime, which is "kind of
> uncomfortable". So, is there a way to set the compile-command to "make
> whatever" for .cc files and to "make anotherthing" for .xml files?
> Adding local variables in xml files dont work for me, since it doesnt
> compile afterwards, cos the source code contains "non-xml" text.

,----[ C-h v compile-command RET ]
| compile-command's value is "make -k "
|
| Documentation:
| *Last shell command used to do a compilation; default for next compilation.
|
| Sometimes it is useful for files to supply local values for this variable.
| You might also use mode hooks to specify it in certain modes, like this:
|
|     (add-hook 'c-mode-hook
|        (lambda ()
|        (unless (or (file-exists-p "makefile")
|                    (file-exists-p "Makefile"))
|          (set (make-local-variable 'compile-command)
|               (concat "make -k "
|                       (file-name-sans-extension buffer-file-name))))))
|
| You can customize this variable.
|
| Defined in `compile'.
`----

(add-hook 'cc-mode-hook                 ; or c-mode-hook, or ?
          (lambda ()
            (set (make-local-variable 'compile-command) "make whatever")))

(add-hook 'xml-mode-hook                ; or sgml-mode-hook, or ?
          (lambda ()
(set (make-local-variable 'compile-command) "make anotherthing")))

--
Kevin Rodgers


reply via email to

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