The error message (that you see in the Messages buuffer) is usually as folows
LaTeX errors in *~/myfile output*. Use C-c` to display
So if there is an error I just hit C-c ` to read it. Alternatively you can check the output buffer which you can call by C-c C-l after the compilation. Even without errors this buffer is worth looking at from time to time as it contains also warnings that usually do not stop the compilation but should be dealt with.
EDIT 1: You can also force emacs/AUCTeX to open a new window if an error occurs during the compilation. Quote from AUCTeX help
User Option: TeX-error-overview-open-after-TeX-run
When this boolean variable is non-nil, the error overview will be automatically opened after running TeX if there are errors or warnings to show.
It should be also possible to control which errors or warnings open the buffer with the error description.
EDIT 2: Following settings might be useful
(setq TeX-error-overview-open-after-TeX-run t)
;;(setq TeX-error-overview-setup 'separate-frame) ;; don't mess up windows in original frame
(setq TeX-display-help nil) ;; don't open help buffer when jumping to source
With this settings pressing j
at the error in the error buffer moves the cursor to the error in the source without opening a help buffer, which I find unnecessary in this case. Correct the error, compile the tex-file and then the error buffer should be closed. Without the compilation AUCTeX has of course no chance to know if the error was corrected.
Addition 3: To make sure the Error Overview window closes again, one can simply force it to close as part of the compilation command:
(defun latex-command ()
(interactive)
(if (get-buffer-window "*TeX errors*") (delete-window (get-buffer-window "*TeX errors*")))
(TeX-command-run-all nil))