Date: Mon, 9 Mar 1998 11:21:57 +0200 (IST) From: Eli Zaretskii To: Alastair Duncan cc: djgpp AT delorie DOT com Subject: Re: Compiling using djgpp and emacs In-Reply-To: <4823c86c7calastairduncan@argonet.co.uk> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Sun, 8 Mar 1998, Alastair Duncan wrote: > I have also recently installed emacs and cannot find out how to > compile code from within emacs. Do I have to drop out of emacs before I > can compile? Of course not. To compile from within Emacs, press Alt-x, then type "compile [Enter]". (In Emacs-speak, Alt is the ``Meta'' key, so you refer to this as `M-x compile RET'.) The default command it runs is "make -k", but you can edit it to anything you like; press [Enter] when you are done, and the command will run. After the compiler exits, Emacs will allow you to step through the error/warning messages it printed. You can go directly to the locus of a certain message by clicking the right mouse button on the line of that message. From the keyboard, press `Ctrl-x `' (that's the grave accent key, to the left of `1') to step through the messages one by one. Subsequent invocations of `M-x compile' will suggest the last command as the default; you can search the history of past command lines with the Up- and Down-arrow keys. If you need to run the same command over and over again, `M-x recompile' is more convenient (it reuses the last command without prompting). Another way of running external commands and catching their input is `M-!', but it only puts the output into an Emacs buffer, it doesn't parse it for error messages like `M-x compile' does. A similar command `M-|' can be used to pipe buffer text, or parts thereof, to an external program. > I've read the faq and tutorials that came with emacs but can't find > anything about compiling. This is neither tutorial nor FAQ stuff. You need to read the on-line manual. The easiest way to find the right chapter is by using the `Info-index' command. To that end, click on "Help | Browse Manuals" on the menu bar, then click right mouse button on the line which begins with "* Emacs": you will be presented with the Emacs manual. Now press the `i' key and type "compile RET". Emacs will use the manual index to find items with the word "compile" in it. If the first place it finds doesn't seem appropriate, press comma `,' (as the prompt says) to find the next one. Another useful documentation-related command is `apropos'. Click "Help | Command Apropos" from the menu bar and type "compile RET". Emacs will display all the commands whose names include the string "compile", and their brief descriptions. "Help | Describe Function" with the name of a command will then bring a more detailed description.