emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org b84018633e 13/14: ox-latex: Split org-latex-compile


From: ELPA Syncer
Subject: [elpa] externals/org b84018633e 13/14: ox-latex: Split org-latex-compile into two funs
Date: Sun, 22 Jan 2023 10:58:11 -0500 (EST)

branch: externals/org
commit b84018633eaebb08b90fca12237b0b892d19a528
Author: TEC <git@tecosaur.net>
Commit: Ihor Radchenko <yantar92@posteo.net>

    ox-latex: Split org-latex-compile into two funs
    
    * lisp/ox-latex.el (org-latex-compile): Split off the postprocessing in
    `org-latex-compile' into a new function,
    `org-latex-compile--postprocess'.
---
 lisp/ox-latex.el | 39 +++++++++++++++++++++++----------------
 1 file changed, 23 insertions(+), 16 deletions(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 330007eba9..156940703a 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -4301,25 +4301,32 @@ produced."
          (outfile (org-compile-file texfile process "pdf"
                                    (format "See %S for details" log-buf-name)
                                    log-buf spec)))
-    (unless snippet
-      (when org-latex-remove-logfiles
-       (mapc #'delete-file
-             (directory-files
-              (file-name-directory outfile)
-              t
-              (concat (regexp-quote (file-name-base outfile))
-                      "\\(?:\\.[0-9]+\\)?\\."
-                      (regexp-opt org-latex-logfiles-extensions))
-              t)))
-      (let ((warnings (org-latex--collect-warnings log-buf)))
-       (message (concat "PDF file produced"
-                        (cond
-                         ((eq warnings 'error) " with errors.")
-                         (warnings (concat " with warnings: " warnings))
-                         (t "."))))))
+    (org-latex-compile--postprocess outfile log-buf snippet)
     ;; Return output file name.
     outfile))
 
+(defun org-latex-compile--postprocess (outfile log-buf &optional snippet)
+  "Process the results of creating OUTFILE via LaTeX compilation.
+Warnings and errors are collected from LOG-BUF.
+When SNIPPET is nil and `org-latex-remove-logfiles' non-nil,
+log files (as specified by `org-latex-logfiles-extensions') are deleted."
+  (unless snippet
+    (when org-latex-remove-logfiles
+      (mapc #'delete-file
+            (directory-files
+             (file-name-directory outfile)
+             t
+             (concat (regexp-quote (file-name-base outfile))
+                     "\\(?:\\.[0-9]+\\)?\\."
+                     (regexp-opt org-latex-logfiles-extensions))
+             t)))
+    (let ((warnings (org-latex--collect-warnings log-buf)))
+      (message (concat "PDF file produced"
+                       (cond
+                        ((eq warnings 'error) " with errors.")
+                        (warnings (concat " with warnings: " warnings))
+                        (t ".")))))))
+
 (defun org-latex--collect-warnings (buffer)
   "Collect some warnings from \"pdflatex\" command output.
 BUFFER is the buffer containing output.  Return collected



reply via email to

[Prev in Thread] Current Thread [Next in Thread]