From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.org!not-for-mail
From: stan <smoore@exis.net>
Newsgroups: gmane.emacs.help
Subject: Re: help with makefile command line
Date: Thu, 27 Mar 2008 21:51:56 -0500
Organization: home
Message-ID: <c33ub5-k56.ln1@invalid.net>
References: <mailman.9409.1206451688.18990.help-gnu-emacs@gnu.org>
	<fsglft$95j$2@registered.motzarella.org>
NNTP-Posting-Host: lo.gmane.org
X-Trace: ger.gmane.org 1206675687 14867 80.91.229.12 (28 Mar 2008 03:41:27 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Fri, 28 Mar 2008 03:41:27 +0000 (UTC)
To: help-gnu-emacs@gnu.org
Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Mar 28 04:41:58 2008
Return-path: <help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org>
Envelope-to: geh-help-gnu-emacs@m.gmane.org
Original-Received: from lists.gnu.org ([199.232.76.165])
	by lo.gmane.org with esmtp (Exim 4.50)
	id 1Jf5TU-0002dR-QW
	for geh-help-gnu-emacs@m.gmane.org; Fri, 28 Mar 2008 04:41:53 +0100
Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43)
	id 1Jf5St-0005FT-9V
	for geh-help-gnu-emacs@m.gmane.org; Thu, 27 Mar 2008 23:41:15 -0400
Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news2.google.com!news.glorb.com!nntpserver.com!zeus.nntpserver.com!10.1.1.41.MISMATCH!pfilter-v0.1!not-for-mail
Original-Newsgroups: gnu.emacs.help
User-Agent: slrn/0.9.8.0 (Linux)
Original-Lines: 42
Original-NNTP-Posting-Date: 28 Mar 2008 02:30:41 GMT
Original-X-Complaints-To: abuse@teranews.com
Original-Xref: shelby.stanford.edu gnu.emacs.help:157390
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 <help-gnu-emacs.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/help-gnu-emacs>,
	<mailto:help-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/pipermail/help-gnu-emacs>
List-Post: <mailto:help-gnu-emacs@gnu.org>
List-Help: <mailto:help-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/help-gnu-emacs>,
	<mailto:help-gnu-emacs-request@gnu.org?subject=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:52760
Archived-At: <http://permalink.gmane.org/gmane.emacs.help/52760>

Richard G Riley wrote:
> "Balaji V. Iyer" <bviyer@ncsu.edu> writes:
>
>> Hello Everyone,
>>     I use the compile option extenstively in emacs. When I type "M-x
>> compile" the default line is "make -k" Many times I do not have a make
>> file thus I would lke the default line to be
>>  
>> "gcc -ansi -O4 -Wall <c_source_file>"
>>  
>> How do I do this?
>>  
>> I tried the following command but it doesn't seem to work (If anyone
>> have a better idea please let me know).
>>  
>> (function
>>  (lambda ()
>>    (unless (or (file-exists-p "makefile")
>>                (file-exists-p "Makefile"))
>>      (setq compile-command
>>            (concat "gcc -Wall -O3 -o"
>>                    (file-name-sans-extension (file-name-nondirectory
>> buffer-file -name))
>>                    " "
>>                    (file-name-nondirectory buffer-file-name))))))
<snip>

Seems like it might be easier to write a makefile :) 

Do you really mean that you plan to not use makefiles? If not you might
just want to change the command on a session basis. You do know that you
can backspace over the make -k and simply type g++ -Wall -g file.cpp and
that will become the new command until you close emacs. I tend to do
that when working on small throwaway programs. 

Another idea, if you don't like what Eli suggested earlier is to come up
with a makefile template and use auto insert. I have a template that I
only need to basically change the list of files in and it save a lot of
time during the compile, run. scream. debug, edit cycle.

Finally, you can edit the compile command for all time but it seems like
a bad idea.