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

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

Re: auto complile the C program in the current buffer


From: GVK
Subject: Re: auto complile the C program in the current buffer
Date: Wed, 16 Feb 2005 14:10:00 +0530
User-agent: Mozilla Thunderbird 1.0 (X11/20041206)

Kevin Rodgers wrote:


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


Thanks a lot. I added the following lines in my .emacs and it's working.

(if
    (or (file-exists-p "makefile") (file-exists-p "Makefile"))
    (set 'compile-command "make -k ")
  (set 'compile-command (concat "gcc " buffer-file-name)))


Regards,
GVK

reply via email to

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