[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: NEWBIE: different compile-commands for different fiel types (cc, xm
Re: NEWBIE: different compile-commands for different fiel types (cc, xml)
Thu, 28 Oct 2004 10:54:18 -0600
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 "
| *Last shell command used to do a compilation; default for next
| 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 ?
(set (make-local-variable 'compile-command) "make whatever")))
(add-hook 'xml-mode-hook ; or sgml-mode-hook, or ?
(set (make-local-variable 'compile-command) "make