32.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. In csh, here
is how to do it:
if ($?prompt) set prompt = ...
And here's how to do it in bash:
if [ "${PS1+set}" = set ]
then PS1=...
fi
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 MS-DOS.