6

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?

B_old
  • 717
  • 5
  • 14
  • 3
    There is a `compilation-save-buffers-predicate`. – xuchunyang Mar 22 '18 at 17:44
  • Since Emacs 28 you can customize `save-some-buffers-default-predicate` with the new value `save-some-buffers-root`. This will restrict the prompts to buffers under the current project (or in a subdir of the dir where the caller is invoked, if no project is found). – Tino Aug 27 '21 at 17:03

1 Answers1

2

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!

phils
  • 48,657
  • 3
  • 76
  • 115
B_old
  • 717
  • 5
  • 14