help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: help with makefile command line


From: Nikolaj Schumacher
Subject: Re: help with makefile command line
Date: Wed, 26 Mar 2008 17:20:36 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.92 (darwin)

"Balaji V. Iyer" <bviyer@ncsu.edu> wrote:

> 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))))))

You create an (nameless) function that will set a new `compile-command'.
However, you don't call the function, therefore you don't see any
effect.

If you did
(funcall (lambda () ...
the function would be executed immediately and do what you want.

Certainly you'll want it to execute automatically:
(add-hook 'c-mode-hook (lambda () ...
will automatically call your function when you open a C file.


regards,
Nikolaj Schumacher




reply via email to

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