emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Temp files are not deleted after beamer export with source code blocks
@ 2013-10-29  3:00 James Harkins
  2013-10-29  8:06 ` Nicolas Goaziou
  0 siblings, 1 reply; 10+ messages in thread
From: James Harkins @ 2013-10-29  3:00 UTC (permalink / raw)
  To: orgmode

I've set org-latex-listings to "Use listings" (not minted), and then run 
this minimal example.

~~~~
#+BIND: org-latex-listings-options (("basicstyle" "\\ttfamily") 
("captionpos" "b") ("tabsize" "3"))

#+LANGUAGE:  en
#+OPTIONS:   H:1 num:t toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t ':t
#+EXPORT_SELECT_TAGS: export
#+EXPORT_EXCLUDE_TAGS: noexport

#+startup: beamer
#+LaTeX_CLASS: beamer
#+LaTeX_CLASS_OPTIONS: [presentation]
#+BEAMER_THEME: default
#+COLUMNS: %45ITEM %10BEAMER_env(Env) %10BEAMER_act(Act) %4BEAMER_col(Col) 
%8BEAMER_opt(Opt)
#+PROPERTY: BEAMER_col_ALL 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 0.0 :ETC

#+LATEX_HEADER: \usepackage{listings}

#+TITLE:     Test
#+AUTHOR:    hjh

* A frame
** You can write some code like this.
#+begin_src {} -i :exports code
some code here
#+end_src
~~~~

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.

hjh

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Temp files are not deleted after beamer export with source code blocks
  2013-10-29  3:00 Temp files are not deleted after beamer export with source code blocks James Harkins
@ 2013-10-29  8:06 ` Nicolas Goaziou
  2013-10-29  9:16   ` James Harkins
  2013-11-06  9:44   ` James Harkins
  0 siblings, 2 replies; 10+ messages in thread
From: Nicolas Goaziou @ 2013-10-29  8:06 UTC (permalink / raw)
  To: James Harkins; +Cc: orgmode

[-- Attachment #1: Type: text/plain, Size: 734 bytes --]

Hello,

James Harkins <jamshark70@gmail.com> 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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-latex-Remove-all-temporary-files-when-compiling.patch --]
[-- Type: text/x-diff, Size: 1300 bytes --]

From 0820b155258f3f675c40089ea67bb7ab359f0709 Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <n.goaziou@gmail.com>
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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: Temp files are not deleted after beamer export with source code blocks
  2013-10-29  8:06 ` Nicolas Goaziou
@ 2013-10-29  9:16   ` James Harkins
  2013-10-29 13:19     ` Nicolas Goaziou
  2013-11-06  9:44   ` James Harkins
  1 sibling, 1 reply; 10+ messages in thread
From: James Harkins @ 2013-10-29  9:16 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: orgmode

On Tuesday, October 29, 2013 5:06:29 PM KST, Nicolas Goaziou wrote:
> It should clean them up. Though, the "-2" suffix implies that a regexp
> is needed to find temporary files.
>
> Does the following patch work?

Will have to try later... some time pressure right now.

An aside: in the last few weeks, I've been doing some more complex things 
in org/beamer with overlays and column layouts, and I have to say, the new 
beamer exporter makes A WHOLE LOT of sense. The outline structure reflects 
the structure of the beamer environments. Really clean. I like it.

hjh

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Temp files are not deleted after beamer export with source code blocks
  2013-10-29  9:16   ` James Harkins
@ 2013-10-29 13:19     ` Nicolas Goaziou
  0 siblings, 0 replies; 10+ messages in thread
From: Nicolas Goaziou @ 2013-10-29 13:19 UTC (permalink / raw)
  To: James Harkins; +Cc: orgmode

Hello,

James Harkins <jamshark70@gmail.com> writes:

> On Tuesday, October 29, 2013 5:06:29 PM KST, Nicolas Goaziou wrote:
>> It should clean them up. Though, the "-2" suffix implies that a regexp
>> is needed to find temporary files.
>>
>> Does the following patch work?
>
> Will have to try later... some time pressure right now.

No problem. The patch can wait. 

Nevertheless, if you think you won't have time soon, just let me know
and I'll apply it so that more persons can test it.

> An aside: in the last few weeks, I've been doing some more complex
> things in org/beamer with overlays and column layouts, and I have to
> say, the new beamer exporter makes A WHOLE LOT of sense. The outline
> structure reflects the structure of the beamer environments. Really
> clean. I like it.

Thank you.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Temp files are not deleted after beamer export with source code blocks
  2013-10-29  8:06 ` Nicolas Goaziou
  2013-10-29  9:16   ` James Harkins
@ 2013-11-06  9:44   ` James Harkins
  2013-11-06 14:15     ` Nicolas Goaziou
  1 sibling, 1 reply; 10+ messages in thread
From: James Harkins @ 2013-11-06  9:44 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: orgmode

On Tuesday, October 29, 2013 4:06:29 PM HKT, Nicolas Goaziou wrote:
> It should clean them up. Though, the "-2" suffix implies that a regexp
> is needed to find temporary files.
>
> Does the following patch work?

It seems not to have any effect. Here's what I did to try it:

1. cd ~/share/org-mode.git
2. git am 
~/tmp/0001-ox-latex-Remove-all-temporary-files-when-compiling.patch
   - No git errors or conflicts here
3. make
   - No compilation errors
4. Quit and relaunch emacs.
   - I have the following in ~/.emacs, so I should be loading org from my 
local git directory.
     (add-to-list 'load-path "/home/dlm/share/org-mode.git/lisp")
     (add-to-list 'load-path "/home/dlm/share/org-mode.git/contrib/lisp" t)
5. Open and export the document in question.

No ***-**.vrb files were deleted.

hjh

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Temp files are not deleted after beamer export with source code blocks
  2013-11-06  9:44   ` James Harkins
@ 2013-11-06 14:15     ` Nicolas Goaziou
  2013-11-07  1:34       ` James Harkins
  0 siblings, 1 reply; 10+ messages in thread
From: Nicolas Goaziou @ 2013-11-06 14:15 UTC (permalink / raw)
  To: James Harkins; +Cc: orgmode

Hello,

James Harkins <jamshark70@gmail.com> writes:

> On Tuesday, October 29, 2013 4:06:29 PM HKT, Nicolas Goaziou wrote:
>> It should clean them up. Though, the "-2" suffix implies that a regexp
>> is needed to find temporary files.
>>
>> Does the following patch work?
>
> It seems not to have any effect. Here's what I did to try it:
>
> 1. cd ~/share/org-mode.git
> 2. git am
> ~/tmp/0001-ox-latex-Remove-all-temporary-files-when-compiling.patch
>   - No git errors or conflicts here
> 3. make
>   - No compilation errors
> 4. Quit and relaunch emacs.
>   - I have the following in ~/.emacs, so I should be loading org from
> my local git directory.
>     (add-to-list 'load-path "/home/dlm/share/org-mode.git/lisp")
>     (add-to-list 'load-path "/home/dlm/share/org-mode.git/contrib/lisp" t)
> 5. Open and export the document in question.

Thanks for the report.

> No ***-**.vrb files were deleted.

Out of curiosity: in my case vrb files follow the template "***.**.vrb"
not "***-**.vrb". Are you sure about the hyphen?


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Temp files are not deleted after beamer export with source code blocks
  2013-11-06 14:15     ` Nicolas Goaziou
@ 2013-11-07  1:34       ` James Harkins
  2013-11-07 16:21         ` Nicolas Goaziou
  0 siblings, 1 reply; 10+ messages in thread
From: James Harkins @ 2013-11-07  1:34 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: orgmode

On Wednesday, November 6, 2013 10:15:44 PM HKT, Nicolas Goaziou wrote:
>> No ***-**.vrb files were deleted.
>
> Out of curiosity: in my case vrb files follow the template "***.**.vrb"
> not "***-**.vrb". Are you sure about the hyphen?

Hm, you're right -- I was sure they are hyphens, but I just looked again 
and they are indeed dots.

As a final test, I deleted all the .vrb files manually and exported my 
document again. Then, after the export process finished, I refreshed a 
dired buffer for the directory in question:

  -rw-rw-r-- 1 dlm dlm   504 Nov  7 09:28 lp-slides.5.vrb
  -rw-rw-r-- 1 dlm dlm   667 Nov  7 09:28 lp-slides.6.vrb
  -rw-rw-r-- 1 dlm dlm   563 Nov  7 09:28 lp-slides.7.vrb
  -rw-rw-r-- 1 dlm dlm   662 Nov  7 09:28 lp-slides.8.vrb

These were all created during the last export cycle, and not deleted by 
that cycle.

hjh

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Temp files are not deleted after beamer export with source code blocks
  2013-11-07  1:34       ` James Harkins
@ 2013-11-07 16:21         ` Nicolas Goaziou
  2013-11-08  7:14           ` James Harkins
  0 siblings, 1 reply; 10+ messages in thread
From: Nicolas Goaziou @ 2013-11-07 16:21 UTC (permalink / raw)
  To: James Harkins; +Cc: orgmode

[-- Attachment #1: Type: text/plain, Size: 886 bytes --]

Hello,

James Harkins <jamshark70@gmail.com> writes:

> Hm, you're right -- I was sure they are hyphens, but I just looked
> again and they are indeed dots.

Thanks for checking.

> As a final test, I deleted all the .vrb files manually and exported my
> document again. Then, after the export process finished, I refreshed
> a dired buffer for the directory in question:
>
>  -rw-rw-r-- 1 dlm dlm   504 Nov  7 09:28 lp-slides.5.vrb
>  -rw-rw-r-- 1 dlm dlm   667 Nov  7 09:28 lp-slides.6.vrb
>  -rw-rw-r-- 1 dlm dlm   563 Nov  7 09:28 lp-slides.7.vrb
>  -rw-rw-r-- 1 dlm dlm   662 Nov  7 09:28 lp-slides.8.vrb
>
> These were all created during the last export cycle, and not deleted
> by that cycle.

The previous patch used a regexp matching an hyphen before the number.

Here's an update which should properly remove these files. Could you
confirm it?


Regards,

-- 
Nicolas Goaziou

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-latex-Remove-all-temporary-files-when-compiling.patch --]
[-- Type: text/x-diff, Size: 1302 bytes --]

From 77fb3960eacc15cdf05559235c20243d7d4eb0b1 Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <n.goaziou@gmail.com>
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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: Temp files are not deleted after beamer export with source code blocks
  2013-11-07 16:21         ` Nicolas Goaziou
@ 2013-11-08  7:14           ` James Harkins
  2013-11-08  7:59             ` Nicolas Goaziou
  0 siblings, 1 reply; 10+ messages in thread
From: James Harkins @ 2013-11-08  7:14 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: orgmode

On Friday, November 8, 2013 12:21:21 AM HKT, Nicolas Goaziou wrote:
> Here's an update which should properly remove these files. Could you
> confirm it?

Yes, working fine. Thanks.
hjh

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Temp files are not deleted after beamer export with source code blocks
  2013-11-08  7:14           ` James Harkins
@ 2013-11-08  7:59             ` Nicolas Goaziou
  0 siblings, 0 replies; 10+ messages in thread
From: Nicolas Goaziou @ 2013-11-08  7:59 UTC (permalink / raw)
  To: James Harkins; +Cc: orgmode

Hello,

James Harkins <jamshark70@gmail.com> writes:

> On Friday, November 8, 2013 12:21:21 AM HKT, Nicolas Goaziou wrote:
>> Here's an update which should properly remove these files. Could you
>> confirm it?
>
> Yes, working fine. Thanks.

Applied then. Thank you for the feedback.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-11-08  8:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-29  3:00 Temp files are not deleted after beamer export with source code blocks James Harkins
2013-10-29  8:06 ` Nicolas Goaziou
2013-10-29  9:16   ` James Harkins
2013-10-29 13:19     ` Nicolas Goaziou
2013-11-06  9:44   ` James Harkins
2013-11-06 14:15     ` Nicolas Goaziou
2013-11-07  1:34       ` James Harkins
2013-11-07 16:21         ` Nicolas Goaziou
2013-11-08  7:14           ` James Harkins
2013-11-08  7:59             ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).