Now checks to see if the buffer is live before setting flags for it. Prevents error messages
No longer runs if Emacs is started in a non-CMake directory, which is obviously handy