From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Temp files are not deleted after beamer export with source code blocks Date: Tue, 29 Oct 2013 09:06:29 +0100 Message-ID: <87hac0a4ca.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34792) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vb4Jh-00073z-Ev for emacs-orgmode@gnu.org; Tue, 29 Oct 2013 04:06:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vb4JY-00061W-4s for emacs-orgmode@gnu.org; Tue, 29 Oct 2013 04:06:21 -0400 Received: from mail-we0-x22b.google.com ([2a00:1450:400c:c03::22b]:38473) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vb4JX-00061F-Ty for emacs-orgmode@gnu.org; Tue, 29 Oct 2013 04:06:12 -0400 Received: by mail-we0-f171.google.com with SMTP id t60so7735264wes.16 for ; Tue, 29 Oct 2013 01:06:11 -0700 (PDT) In-Reply-To: (James Harkins's message of "Tue, 29 Oct 2013 11:00:57 +0800") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: James Harkins Cc: orgmode --=-=-= Content-Type: text/plain Hello, James Harkins writes: > I've set org-latex-listings to "Use listings" (not minted), and then run > this minimal example. [...] > Now there is a file "beamer-listings-2.vrb" containing the LaTeX code for > the second frame. This file never gets deleted. As I'm developing the > presentation, chances are that frame will end up becoming a different frame > number, so I keep getting more and more vrb files on disk. > > Shouldn't org clean these up after LaTeX is finished? It already cleans up > other temporary LaTeX files. It should clean them up. Though, the "-2" suffix implies that a regexp is needed to find temporary files. Does the following patch work? Regards, -- Nicolas Goaziou --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-ox-latex-Remove-all-temporary-files-when-compiling.patch >From 0820b155258f3f675c40089ea67bb7ab359f0709 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 b0cc4bb..a1d30aa 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -2903,9 +2903,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.1 --=-=-=--