https://github.com/textmate/blitzmax.tmbundle
The TextMate bundle uses environment settings to compile projects, not just buffers. Thanks to .tm_properties files, these can be set per directory/project, which is nice. I think with the power of .dir-locals.el to auto-load when opening a buffer, one can do the same for Emacs.
My elisp isn't that good, that's why I didn't work on a PR right away and want to coordinate efforts first. What do you think?