Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!uunet!wuarchive!zaphod.mps.ohio-state.edu!ub!acsu.buffalo.edu From: bandu@acsu.buffalo.edu (Jagath Samarabandu) Newsgroups: comp.emacs Subject: Re: compile c in emacs Message-ID: <59862@eerie.acsu.Buffalo.EDU> Date: 14 Feb 91 20:35:03 GMT References: <59658@eerie.acsu.Buffalo.EDU> Sender: news@acsu.Buffalo.EDU Organization: SUNY/Buffalo Electrical Eng. Lines: 21 Nntp-Posting-Host: autarch.acsu.buffalo.edu In article <59658@eerie.acsu.Buffalo.EDU> haozhou@acsu.buffalo.edu (Hao Zhou) writes: >My question is how do you compile c source code within emacs without >creating a shell window? I am on Sparc/SunOS. One neat trick I found (this is probably common knowledge. But I'll say it anyway) is to define the compile command as a 'buffer-local' variable and then bind the M-x compile to a key combination like C-c C-c. Then, when I type C-c C-c, voila... It gives the correct command. By adding this at the end of a file called boundary.c, I can define the compile-command variable. /* Local Variables: */ /* compile-command: "gcc boundary.c -o boundary -lm -O" */ /* End: */ Capitalization and space between '/*', '*/' and all words are important. Bandu PS: All this (and more) can be found in the info section while in gnu-emacs.