I use plain emacs in a terminal and like it that way (no spacemacs or gui emacs for me). In the gui versions, error messages pop up in a floating window, I think, and can be batted away. In my setup they open in a new split window and steal focus. To get rid of it I have to move the pointer back to my code window and then, if I want my code window full width, maximize the code window by deleting the other error window with a binding (which keeps the error window in the buffer list for reference). It's a lot of keystrokes for a simple error message. Ideally, I would like to not lose the focus from my code when they appear, and banish the error message window with a single binding (but keep it in the buffer list for reference... ideally being able to recall it in the way it initially appeared [in a split, without stealing focus] with another binding?
It is possible to dismiss an error window with C-x 0 (delete-window) if it has focus, but if previously you had two windows open in, say, a horizontal split, the error appears in the other window, and dismissing the error window removes your previous split. I create lots of unpredictable configurations so using a window arranger will not work for me to restore some preconfigured window arrangement.
How could I achieve this?
Not sure exactly if the errors you mention are compilation errors when developing Clojure/script but, in my experience (I also use Emacs in a terminal), you can dismiss the error message just by pressing q
and it will close the frame and move the cursor back to the original frame.
Here's a short video of my experience: https://i.sstatic.net/33Jzq.jpg
I also tried it having more than one frame, and it works as expected: it splits only the code editor frame to show the error; if you dismiss the error it removes the new frame and will keep your existing layout.