How can I set AucTex to either (a) not pop up that annoying compilation buffer every time I C-c C-c or (b) only pop it up if compilation is not successful? (b) is preferable, but if it's too hard then I'm fine with (a).

  • (a) is not the default behavior, no compilation buffer is shown by default. You activated it somehow. – giordano Sep 1 '16 at 12:11

I have this in my latex config, but I forget where it come from ...it does (b)

(defadvice TeX-LaTeX-sentinel
    (around mg-TeX-LaTeX-sentinel-open-output activate)
  "Open output when there are errors."
  ;; Run `TeX-LaTeX-sentinel' as usual.
  ;; Check for the presence of errors.
      (with-current-buffer TeX-command-buffer
        (plist-get TeX-error-report-switches (intern (TeX-master-file))))
    ;; If there are errors, open the output buffer.
    (TeX-recenter-output-buffer nil)))
  • I guess it's my answer here: tex.stackexchange.com/a/185763 But really, compilation buffer is not shown by default, my guess is that the OP activated it with (setq TeX-show-compilation t). – giordano Dec 30 '16 at 15:23
  • @giordano Actually, I eventually figured out it was because I was using emac's latex-mode (I think). Anyway, I don't have the problem now. – Elliot Gorokhovsky Dec 30 '16 at 20:48

When I was looking for to avoid this, I didn't found. But I finnaly found a solution to get around the problem by using latexmk. The following code may help you :

(defun run-latexmk ()
  "It compiles the current document"
  (let ((TeX-save-query nil)
        (TeX-process-asynchronous nil)
        (master-file (TeX-master-file)))
    (TeX-save-document "")
    (TeX-run-TeX "latexmk"
         (TeX-command-expand "latexmk -pdf %t" 'TeX-master-file)
    (minibuffer-message "latexmk done")))

This was inspired by this page about how to make latexmk run the appropriate amount of times.

Then you can rebind C-c C-c with something like (local-set-key (kbd "C-c C-c") #'run-latexmk).

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.