I often have buffers from unrelated projects open. Before compiling I use projectile-save-project-buffers to save all relevant buffers. If other buffers happen to contain unsaved modifications, however, I will still be prompted about them, before I can compile.
Now there is compilation-ask-about-save:
compilation-ask-about-save is a variable defined in ‘compile.el’. Its value is t Documentation: Non-nil means M-x compile asks which buffers to save before compiling. Otherwise, it saves all modified buffers without asking. You can customize this variable. [back]
The problem is, that I don't want to save those unrelated buffers. Is there another variable that I'm missing? Can I configure emacs in a way so that it just compiles the current saved state without further prompts?