From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.help Subject: Re: gcc on xemacs Date: Mon, 06 Jun 2005 10:54:05 -0600 Message-ID: References: <1118040866.603671.232900@g14g2000cwa.googlegroups.com> 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 1118077041 987 80.91.229.2 (6 Jun 2005 16:57:21 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 6 Jun 2005 16:57:21 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jun 06 18:57:19 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DfKti-0007nD-KW for geh-help-gnu-emacs@m.gmane.org; Mon, 06 Jun 2005 18:56:22 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DfL04-0000c3-3S for geh-help-gnu-emacs@m.gmane.org; Mon, 06 Jun 2005 13:02:56 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DfKzj-0000YL-Ar for help-gnu-emacs@gnu.org; Mon, 06 Jun 2005 13:02:35 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DfKzf-0000WB-UX for help-gnu-emacs@gnu.org; Mon, 06 Jun 2005 13:02:33 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DfKzf-0000Vi-4j for help-gnu-emacs@gnu.org; Mon, 06 Jun 2005 13:02:31 -0400 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtp (TLS-1.0:RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1DfKz8-0000Mp-Vm for help-gnu-emacs@gnu.org; Mon, 06 Jun 2005 13:01:59 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1DfKqG-0007JI-Li for help-gnu-emacs@gnu.org; Mon, 06 Jun 2005 18:52:48 +0200 Original-Received: from 207.167.42.60 ([207.167.42.60]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 06 Jun 2005 18:52:48 +0200 Original-Received: from ihs_4664 by 207.167.42.60 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 06 Jun 2005 18:52:48 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: help-gnu-emacs@gnu.org Original-Lines: 56 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 207.167.42.60 User-Agent: Mozilla Thunderbird 0.9 (X11/20041105) X-Accept-Language: en-us, en In-Reply-To: <1118040866.603671.232900@g14g2000cwa.googlegroups.com> 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 Xref: news.gmane.org gmane.emacs.help:27289 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:27289 arya.punit@gmail.com wrote: > how do i compile a single c/c++ file using gcc on xemacs in the > minibuffer. on clicking compile in menubar i get "make -k" in > minibuffer, but i want to change this command permanently so that it > displays "gcc -Wall" followed by the current active buffer file.c or > file.cpp. i donot know howto edit that custom settings elisp file in a > texteditor. ,----[ 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'. `---- I think you want something like: (add-hook 'c-mode-hook (lambda () (set (make-local-variable 'compile-command) (format "gcc -Wall %s.o" (file-name-sans-extension (file-name-nondirectory buffer-file-name)))))) Although make's default rules and macros will work: (add-hook 'c-mode-hook (lambda () (set (make-local-variable 'compile-command) (format "make %s.o" (file-name-sans-extension (file-name-nondirectory buffer-file-name)))))) in conjunction with these shell settings: CC=gcc; export CC CFLAGS=-Wall; export CFLAGS -- Kevin Rodgers