C-h f compile tells you:
Compile the program including the current buffer. Default: run
Runs COMMAND, a shell command, in a separate process asynchronously
with output going to the buffer
You can then use the command
C-x ` to find the next error message
and move to the source code that caused it.
If optional second arg COMINT is t the buffer will be in Comint mode with
Interactively, prompts for the command if the variable
compilation-read-command is non-nil; otherwise uses
With prefix arg, always prompts.
Additionally, with universal prefix arg, compilation buffer will be in
comint mode, i.e. interactive.
To run more than one compilation at once, start one then rename
*compilation* buffer to some other name with
M-x rename-buffer. Then switch buffers and start the new compilation.
It will create a new
On most systems, termination of the main compilation process
kills its subprocesses.
The name used for the buffer is actually whatever is returned by
the function in
compilation-buffer-name-function, so you can set that
to a function that generates a unique name.
The part in bold tells you the answer: be sure that user option
compilation-read-command is set to a non-
And if you click the
compilation-read-command link in that
*Help* output then you get even more information about its behavior:
Non-nil means M-x compile reads the compilation command to use.
Otherwise, M-x compile just uses the value of
Note that changing this to nil may be a security risk, because a
file might define a malicious
compile-command as a file local
variable, and you might not notice. Therefore,
is considered unsafe if this variable is nil.