I've recently switched to using emacs.
One of the things that I want to be able to do is to toggle the appearance of the compilation buffer using Ctrl+,
(i.e. when the compilation buffer is visible on the screen, I want to be able to press Ctrl+,
to hide it, and then press Ctrl+,
to bring it back up).
Here is a function modified from Spacemacs:
(defun toggle-compilation-window ()
"Show/Hide the window containing the '*compilation*' buffer."
(interactive)
(when-let ((buffer compilation-last-buffer))
(if (get-buffer-window buffer 'visible)
(delete-windows-on buffer)
(display-buffer buffer))))
(bind-key "C-," #'toggle-compilation-window)
I also suggest taking a look at this awesome package popper