Download GNU Emacs Manual - Programming Systems Lab
Transcript
Chapter 24: Compiling and Testing Programs
257
Compilation mode also redefines the keys SPC and DEL to scroll by screenfuls, and
M-n (compilation-next-error) and M-p (compilation-previous-error) to move to the
next or previous error message. You can also use M-{ (compilation-next-file and M-}
(compilation-previous-file) to move up or down to an error message for a different
source file.
You can type C-c C-f to toggle Next Error Follow mode. In this minor mode, ordinary
cursor motion in the compilation buffer automatically updates the source buffer. For instance, moving the cursor to the next error message causes the location of that error to be
displayed immediately.
The features of Compilation mode are also available in a minor mode called Compilation
Minor mode. This lets you parse error messages in any buffer, not just a normal compilation
output buffer. Type M-x compilation-minor-mode to enable the minor mode. This defines
the keys RET and Mouse-2, as in the Compilation major mode.
Compilation minor mode works in any buffer, as long as the contents are in a format
that it understands. In an Rlogin buffer (see Section 31.2.11 [Remote Host], page 360),
Compilation minor mode automatically accesses remote source files by FTP (see Section 15.1
[File Names], page 111).
24.3 Subshells for Compilation
Emacs uses a shell to run the compilation command, but specifies the option for a noninteractive shell. This means, in particular, that the shell should start with no prompt. If
you find your usual shell prompt making an unsightly appearance in the ‘*compilation*’
buffer, it means you have made a mistake in your shell’s init file by setting the prompt
unconditionally. (This init file’s name may be ‘.bashrc’, ‘.profile’, ‘.cshrc’, ‘.shrc’,
or various other things, depending on the shell you use.) The shell init file should set the
prompt only if there already is a prompt. Here’s how to do it in bash:
if [ "${PS1+set}" = set ]
then PS1=...
fi
And here’s how to do it in csh:
if ($?prompt) set prompt = ...
There may well be other things that your shell’s init file ought to do only for an interactive
shell. You can use the same method to conditionalize them.
The MS-DOS “operating system” does not support asynchronous subprocesses; to work
around this lack, M-x compile runs the compilation command synchronously on MS-DOS.
As a consequence, you must wait until the command finishes before you can do anything
else in Emacs. See Info file ‘emacs-xtra’, node ‘MS-DOS’.
24.4 Searching with Grep under Emacs
Just as you can run a compiler from Emacs and then visit the lines with compilation errors,
you can also run grep and then visit the lines on which matches were found. This works by
treating the matches reported by grep as if they were “errors.” The buffer of matches uses
Grep mode, which is a variant of Compilation mode (see Section 24.2 [Compilation Mode],
page 255).
Related documents
GNU Emacs Manual - Mr. Gober`s Website
GNU Emacs Manual
GNU Emacs Manual
Wiley ASP.NET 2.0 Instant Results
GNU Emacs Manual - Journal of the Australian Mathematical
Installing and Starting Emacs
XEmacs User`s Manual
HP Apollo 9000 400t Technical data
Long Reference Card pdf
GNU Emacs Manual
Excerpts from “The Linux Users` Guide”
Hemlock User`s Manual Abstract - Common