From 77fb3960eacc15cdf05559235c20243d7d4eb0b1 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Tue, 29 Oct 2013 09:02:29 +0100 Subject: [PATCH] ox-latex: Remove all temporary files when compiling * lisp/ox-latex.el (org-latex-compile): Remove all numbered temporary files after compiling. --- lisp/ox-latex.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index f14a1f9..1da5f52 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -2900,9 +2900,13 @@ Return PDF file name or an error if it couldn't be produced." ;; Else remove log files, when specified, and signal end of ;; process to user, along with any error encountered. (when (and (not snippet) org-latex-remove-logfiles) - (dolist (ext org-latex-logfiles-extensions) - (let ((file (concat out-dir base-name "." ext))) - (when (file-exists-p file) (delete-file file))))) + (dolist (file (directory-files + out-dir t + (concat (regexp-quote base-name) + "\\(?:\\.[0-9]+\\)?" + "\\." + (regexp-opt org-latex-logfiles-extensions)))) + (delete-file file))) (message (concat "Process completed" (if (not errors) "." (concat " with errors: " errors))))) -- 1.8.4.2