emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with makefile command line


From: Mike Mattie
Subject: Re: Help with makefile command line
Date: Tue, 25 Mar 2008 21:17:32 -0700

On Tue, 25 Mar 2008 09:11:58 -0400
"Balaji V. Iyer" <address@hidden> wrote:

> 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
   ^^^ defun
>  (lambda ()
>    (unless (or (file-exists-p "makefile")
                                 ^^
                                 strange?
>                (file-exists-p "Makefile"))
>      (setq compile-command
       ^^^
       why modify a variable each time ? pass as an argument function ?
>            (concat "gcc -Wall -O3 -o"
>                    (file-name-sans-extension (file-name-nondirectory
> buffer-file -name))
             ^^
             broken ?

>                    " "
>                    (file-name-nondirectory buffer-file-name))))))
                      ^^^
                      computed twice, should bind.
>  
>  
>  
> Any help is greatly appreciated.

also concatenating arguments means that some external shell is going to have to 
split the args again,
usually better (no quoting issues), to simply pass off the arguments to exec 
without invoking the shell
if you can.

Hope that helps a bit.

> Oh, one thing..I am using emacs 21.2.1 on cygwin
>  
> Thanks,
>  

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]