I like having TeX-show-compilation in LaTeX for large documents. However, if the compilation completed successfully, I would like the windows to be reverted or the compilation buffer to be killed. I have tried following the suggestions given in: hide *compilation* window without any luck.
*compilation* buffer has nothing to do with LaTeX.
You mean the process output buffer of
You can use the following lisp code to delete the buffer window when there are no LaTeX errors.
If you also want to keep the output buffer for LaTeX warnings switch off
TeX-buf-close-at-warnings-only via M-x
(defcustom TeX-buf-close-at-warnings-only t "Close TeX buffer if there are only warnings." :group 'TeX-output :type 'boolean) (defun my-tex-close-TeX-buffer (_output) "Close compilation buffer if there are no errors. Hook this function into `TeX-after-compilation-finished-functions'." (let ((buf (TeX-active-buffer))) (when (buffer-live-p buf) (with-current-buffer buf (when (progn (TeX-parse-all-errors) (or (and TeX-buf-close-at-warnings-only (null (cl-assoc 'error TeX-error-list))) (null TeX-error-list))) (cl-loop for win in (window-list) if (eq (window-buffer win) (current-buffer)) do (delete-window win))))))) (add-hook 'TeX-after-compilation-finished-functions #'my-tex-close-TeX-buffer)