[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Avoid ignoring LaTeX export output errors when org-latex-pdf-pro
From: |
Ihor Radchenko |
Subject: |
[PATCH] Avoid ignoring LaTeX export output errors when org-latex-pdf-process is a list |
Date: |
Sun, 22 May 2022 11:51:02 +0800 |
Hi,
The attached patch is fixing a rather annoying problem when
org-latex-pdf-process is set to a list. Currently, only output of the
last command in the list is preserved in *Org PDF LaTeX output* buffer,
which sometimes prevents ox-latex from detecting compilation warnings.
ox-latex relies on *Org PDF LaTeX output* to contain the output of latex
compiler. However, unless the last command in the org-latex-pdf-process
is something like pdflatex, the compiler errors are erased by
`shell-command' called by `org-compile-file'.
Best,
Ihor
>From d4f15ed260f47195b01cb60061b57823428d2eef Mon Sep 17 00:00:00 2001
Message-Id:
<d4f15ed260f47195b01cb60061b57823428d2eef.1653191200.git.yantar92@gmail.com>
From: Ihor Radchenko <yantar92@gmail.com>
Date: Sun, 22 May 2022 11:44:56 +0800
Subject: [PATCH] Avoid ignoring LaTeX export output errors
* lisp/org-macs.el (org-compile-file): When PROCESS is a list, keep
output of all the listed commands, not just the last one.
* lisp/ox-latex.el (org-latex-pdf-process): Clarify that the process
output is parsed to detect compilation errors/warnings.
---
lisp/org-macs.el | 9 +++++++--
lisp/ox-latex.el | 3 +++
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/lisp/org-macs.el b/lisp/org-macs.el
index 10eed2686..2a7131ded 100644
--- a/lisp/org-macs.el
+++ b/lisp/org-macs.el
@@ -323,8 +323,13 @@ (defun org-compile-file (source process ext &optional
err-msg log-buf spec)
(?F . ,(shell-quote-argument full-name))
(?o . ,(shell-quote-argument out-dir))
(?O . ,(shell-quote-argument output))))))
- (dolist (command process)
- (shell-command (format-spec command spec) log-buf))
+ ;; Combine output of all commands in PROCESS.
+ (with-current-buffer log-buf
+ (let (buffer-read-only)
+ (erase-buffer)))
+ (let ((shell-command-dont-erase-buffer t))
+ (dolist (command process)
+ (shell-command (format-spec command spec) log-buf)))
(when log-buf (with-current-buffer log-buf (compilation-mode)))))
(_ (error "No valid command to process %S%s" source err-msg))))
;; Check for process failure. Output file is expected to be
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 5a2de8afb..ed16ec46f 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -1426,6 +1426,9 @@ (defcustom org-latex-pdf-process
"%latex -interaction nonstopmode -output-directory %o %f"))
"Commands to process a LaTeX file to a PDF file.
+The command output will be parsed to extract compilation errors and
+warnings according to `org-latex-known-warnings'.
+
This is a list of strings, each of them will be given to the
shell as a command. %f in the command will be replaced by the
relative file name, %F by the absolute file name, %b by the file
--
2.35.1
- [PATCH] Avoid ignoring LaTeX export output errors when org-latex-pdf-process is a list,
Ihor Radchenko <=