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

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.


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?

  • 3
    There is a compilation-save-buffers-predicate. – xuchunyang Mar 22 '18 at 17:44

The solution for me is to add:

;; Don't save anything before compiling
(setq compilation-save-buffers-predicate 'ignore)

Thanks to xuchunyang for pointing it out!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.