From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: GVK Newsgroups: gmane.emacs.help Subject: Re: auto complile the C program in the current buffer Date: Wed, 16 Feb 2005 14:10:00 +0530 Organization: Aioe.org NNTP Server Message-ID: References: <37c9nbF59kk9pU1@individual.net> <37etouF55h81jU1@individual.net> NNTP-Posting-Host: main.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 1108543666 30113 80.91.229.2 (16 Feb 2005 08:47:46 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 16 Feb 2005 08:47:46 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Feb 16 09:47:46 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1D1KqT-0000Wy-BG for geh-help-gnu-emacs@m.gmane.org; Wed, 16 Feb 2005 09:47:41 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D1L6N-0002VC-CI for geh-help-gnu-emacs@m.gmane.org; Wed, 16 Feb 2005 04:04:07 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!proxad.net!fr.ip.ndsoftware.net!zen.net.uk!dedekind.zen.co.uk!213.155.197.138.MISMATCH!aioe.org!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 25 Original-NNTP-Posting-Host: BAkPw1tFtsF5IWLEhBNnDw.domitilla.aioe.org Original-X-Complaints-To: abuse@aioe.org Original-NNTP-Posting-Date: Wed, 16 Feb 2005 08:38:46 +0000 (UTC) User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) Original-Xref: shelby.stanford.edu gnu.emacs.help:128593 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: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org X-MailScanner-To: geh-help-gnu-emacs@m.gmane.org Xref: main.gmane.org gmane.emacs.help:24124 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:24124 Kevin Rodgers wrote: > > > 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)))))) > Thanks a lot. I added the following lines in my .emacs and it's working. (if (or (file-exists-p "makefile") (file-exists-p "Makefile")) (set 'compile-command "make -k ") (set 'compile-command (concat "gcc " buffer-file-name))) Regards, GVK