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

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

Changing the Compile-Command in C/C++ Mode


From: Balaji V. Iyer
Subject: Changing the Compile-Command in C/C++ Mode
Date: Fri, 27 Jan 2006 08:43:11 -0500

Hi Everyone,
        I do not always use a make file and I would like the emacs (version
21.2.1) to modify the compile-command line to "g++ -Wall -O4 filename.c. I
thought this script did the trick but it didn't. I do not get any syntax
error, but when I hit the M-x compile command I still get "make -k"
How can I fix this? If you have an alternative implementation, I am willing
to use that too.

(function
           (lambda ()
             (unless (or (file-exists-p "makefile")
                         (file-exists-p "Makefile"))
               (make-local-variable 'compile-command)
               (setq compile-command
                     (concat "gcc -Wall -O3 -o"
                             (file-name-sans-extension
(file-name-nondirectory buffer-file-name))
                             " "
                             (file-name-nondirectory buffer-file-name))))))

Any help is highly appreciated.

Thanking You,

Yours Sincerely,

Balaji V. Iyer.

PS. Please CC me when replying since I am not a subscribed member to this
mailing list.





reply via email to

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