If I compile my latex document in auctex, an overview window of the errors pops up where I can select specific errors and jump to that source code position. However after fixing the errors and compiling successfully the windows containing error messages remain open but showing another buffer, i.e. the initial window remains splitted. How can I make emacs to close those windows automatically after fixing the errors and recompiling successfully?

  • What you would like to achieve is actually the default behavior. The error overview buffer is killed when a new TeX command is run. What's your TeX-error-overview-setup? – giordano Nov 16 '16 at 18:33
  • @See my edit above, my initial description wasn't clear. Suppose I have only one window showing a latex-file, if I compile a buggy code, the window splits and the error messages are listed in the splitted window. If I fix the errors and recompile the new window remains (but doesn't show any errors anymore but another buffer). – student Nov 16 '16 at 19:54
  • The value of TeX-error-overview-setup is nil – student Nov 16 '16 at 19:55
  • Oh, now I understand. I'll have a look – giordano Nov 16 '16 at 20:32
  • @giordano Maybe, my answer does the job already. (I want to prevent that you put too much work in it.) – Tobias Nov 16 '16 at 21:00

I am not aware of any Auctex-option that lets the TeX-error buffer window close. But, adding the following stuff to your init file should do the job. It deletes the window of the buffer in TeX-error-overview-mode when it is killed.

EDIT: Delete also the window showing the "*TeX Help*" buffer.

(defun TeX-error-delete-window ()
  "Delete TeX error window when there are no errors to show."
  (let ((w (get-buffer-window))
    (b (get-buffer "*TeX Help*")))
    (when w
      (delete-window w))
    (when b
      (setq w (get-buffer-window b))
      (when w
    (delete-window w)))))

(defun TeX-error-install-delete-window-hook ()
  "Install `TeX-error-delete-window' in buffer-local `kill-buffer-hook'."
  (add-hook 'kill-buffer-hook #'TeX-error-delete-window nil t))

(add-hook 'TeX-error-overview-mode-hook #'TeX-error-install-delete-window-hook)  
  • @student Now, also the window showing the "*TeX Help*" buffer is deleted. – Tobias Nov 16 '16 at 21:28

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.