From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.help Subject: Re: NEWBIE: different compile-commands for different fiel types (cc, xml) Date: Thu, 28 Oct 2004 10:54:18 -0600 Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <2ucmhuF28b1stU1@uni-berlin.de> References: <2uccnrF29k9q8U1@uni-berlin.de> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1098982650 5890 80.91.229.6 (28 Oct 2004 16:57:30 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 28 Oct 2004 16:57:30 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Oct 28 18:57:17 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CNDaO-0003WQ-00 for ; Thu, 28 Oct 2004 18:57:16 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CNDiB-0004ED-MA for geh-help-gnu-emacs@m.gmane.org; Thu, 28 Oct 2004 13:05:19 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!fu-berlin.de!uni-berlin.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 44 Original-X-Trace: news.uni-berlin.de n03mRxp0dwCWpnSn3MOfpQHiCPy0HX5K5/iTKmNQj5+RwzOcw= User-Agent: Mozilla Thunderbird 0.8 (X11/20040916) X-Accept-Language: en-us, en In-Reply-To: <2uccnrF29k9q8U1@uni-berlin.de> Original-Xref: shelby.stanford.edu gnu.emacs.help:126170 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:21550 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:21550 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