1

The outcome (success/error) of a Latex compilation (TeX-command-run-all) is printed in the echo area. Once you press a key, however, the echo area is cleared and the message is gone. I usually look at the pdf viewer when I compile, and continue typing if the pdf looks ok. This means I often miss Latex error messages. I find this annoying. I keep writing only to discover much later that my document contains an error.

Of course I can keep open a window showing the last couple lines in the *Messages* buffer, but then I have to look at all kind messages that are completely irrelevant to me. So I am asking if somebody can suggest a more convenient solution.

An easy solution would be to stop clearing the echo area after the next keystroke. Somehow make an error message stick in the echo area?

1

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))
  • The problem is that I don't see the error in the first place. Once I realize I have an error, I analyze it with C-c`. – StarBug May 22 at 14:30
  • Sure I could keep the output buffer open, but it really contains too much information that I want too look at it all the time. I compile so often, I just need to know if it is a success or error. Like in the mode line for example. – StarBug May 22 at 14:39
  • I'm not suggesting to keep the output buffer open, because it is a waste of space. Checking from time to time is worth it. Anyway, I updated my answer and hope that helps. – andrej May 22 at 15:02
  • The TeX-error-overview-open-after-TeX-run option is useful, thanks. If I could make it close the overview window again after the error is corrected, it would be a really nice solution. – StarBug May 22 at 17:37
  • Updated the answer once again. – andrej May 23 at 8:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.