compilation-save-buffers-predicate

compilation-save-buffers-predicate is a variable defined in `compile.el'.
Its value is
nil

  • This variable may be risky if used as a file-local variable.

Documentation:
The second argument (PRED) passed to `save-some-buffers' before compiling.
E.g., one can set this to
(lambda ()
(string-prefix-p my-compilation-root (file-truename (buffer-file-name))))
to limit saving to files located under `my-compilation-root'.
Note, that, in general, `compilation-directory' cannot be used instead
of `my-compilation-root' here.

You can customize this variable.

This variable was introduced, or its default value was changed, in version 24.1 of Emacs.