For a while the *Org PDF LaTeX Output* buffer has been empty for me when I export to PDF.

I am currently using: Org mode version 9.7-pre (release_9.6.4-337-geaf274 

It looks like this happens because of this code:

https://git.sr.ht/~bzg/org-mode/tree/main/item/lisp/ox-latex.el#L4313

It seems to have been added in
commit f0dfbf0c3999e44ef7b6704e6584aa2a5d43f2d8

Author: TEC <git@tecosaur.net>

Date:   Sun Dec 25 00:59:21 2022 +0800


    ox-latex: Erase compile buffer at the start

   

    * lisp/ox-latex.el (org-latex-compile): Before running the compile

    command, erase the log buffer to ensure that stale/old logging is

    cleared.


It seems like it is in the wrong place though, and it erases the buffer after the compile happens.

It looks like the code should be modified to look like something like this:

(defun org-latex-compile (texfile &optional snippet)
  "Compile a TeX file.

TEXFILE is the name of the file being compiled.  Processing is
done through the command specified in `org-latex-pdf-process',
which see.  Output is redirected to \"*Org PDF LaTeX Output*\"
buffer.

When optional argument SNIPPET is non-nil, TEXFILE is a temporary
file used to preview a LaTeX snippet.  In this case, do not
create a log buffer and do not remove log files.

Return PDF file name or raise an error if it couldn't be
produced."
  (unless snippet (message "Processing LaTeX file %s..." texfile))
  (let* ((compiler
 (or (with-temp-buffer
(save-excursion (insert-file-contents texfile))
(and (search-forward-regexp (regexp-opt org-latex-compilers)
   (line-end-position 2)
   t)
    (progn (beginning-of-line) (looking-at-p "%"))
    (match-string 0)))
              ;; Cannot find the compiler inserted by
              ;; `org-latex-template' -> `org-latex--insert-compiler'.
              ;; Use a fallback.
              org-latex-compiler))
(process (if (functionp org-latex-pdf-process) org-latex-pdf-process
   ;; Replace "%latex" with "%L" and "%bib" and
   ;; "%bibtex" with "%B" to adhere to `format-spec'
   ;; specifications.
   (mapcar (lambda (command)
     (replace-regexp-in-string
                               "%\\(?:\\(?:bib\\|la\\)tex\\|bib\\)\\>"
      (lambda (m) (upcase (substring m 0 2)))
      command))
   org-latex-pdf-process)))
         (spec `((?B . ,(shell-quote-argument org-latex-bib-compiler))
                 (?L . ,(shell-quote-argument compiler))))
(log-buf-name "*Org PDF LaTeX Output*")
         (log-buf (and (not snippet) (get-buffer-create log-buf-name)))
         (outfile))
    (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))

WDYT?
--
John

-----------------------------------
Professor John Kitchin (he/his)
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
https://kitchingroup.cheme.cmu.edu
https://pointbreezepubs.gumroad.com/ pycse bookstore