I have just started using Emacs as an IDE. While in Emacs, I would like to compile a file(using M-x Compile which opens a new window showing errors/success) and then if there are no errors I want to close the newly opened window containing the buffer named *compilation*(using a single command sequence) so that the whole frame layout is back to what it was before. I don't think there's an inbuilt key-combination to do this, does somebody have any ideas how I can achieve this using some macro or something ?