unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Kevin Rodgers <ihs_4664@yahoo.com>
Subject: Re: NEWBIE: different compile-commands for different fiel types (cc,  xml)
Date: Thu, 28 Oct 2004 10:54:18 -0600	[thread overview]
Message-ID: <2ucmhuF28b1stU1@uni-berlin.de> (raw)
In-Reply-To: <2uccnrF29k9q8U1@uni-berlin.de>

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	other threads:[~2004-10-28 16:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-28 14:04 NEWBIE: different compile-commands for different fiel types (cc, xml) Johannes Kastl
2004-10-28 16:54 ` Kevin Rodgers [this message]
2004-10-31 21:58 ` Kai Grossjohann
     [not found] ` <mailman.6438.1099256981.2017.help-gnu-emacs@gnu.org>
2004-11-07 17:10   ` Johannes Kastl

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=2ucmhuF28b1stU1@uni-berlin.de \
    --to=ihs_4664@yahoo.com \
    /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).