org-latex-compile: Fix erasing PDF output buffer late

* lisp/ox-latex.el (org-latex-compile): Clear the PDF output log
buffer before running compile command.

Fixes regression introduced in 0dfbf0c3.

Reported-by: John Kitchin <jkitchin@andrew.cmu.edu>
Link: https://orgmode.org/list/CALEYq0_t38_gsmjE-qgPCX07-V0P8FYwYEt9R4AT0dZ_SnXRuA@mail.gmail.com
This commit is contained in:
Ihor Radchenko 2023-04-30 10:14:13 +02:00
parent 52d9961f50
commit 42e95938ed
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 7 additions and 3 deletions

View File

@ -4307,11 +4307,15 @@ produced."
(?L . ,(shell-quote-argument compiler))))
(log-buf-name "*Org PDF LaTeX Output*")
(log-buf (and (not snippet) (get-buffer-create log-buf-name)))
(outfile (org-compile-file texfile process "pdf"
(format "See %S for details" log-buf-name)
log-buf spec)))
outfile)
;; Erase compile buffer at the start.
(with-current-buffer log-buf
(erase-buffer))
(setq outfile
(org-compile-file
texfile process "pdf"
(format "See %S for details" log-buf-name)
log-buf spec))
(org-latex-compile--postprocess outfile log-buf snippet)
;; Return output file name.
outfile))