[O] Temp files are not deleted after beamer export with source code blocks

2013-10-28 Thread James Harkins
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



Re: [O] Temp files are not deleted after beamer export with source code blocks

2013-10-29 Thread Nicolas Goaziou
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
>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



Re: [O] Temp files are not deleted after beamer export with source code blocks

2013-10-29 Thread James Harkins

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



Re: [O] Temp files are not deleted after beamer export with source code blocks

2013-10-29 Thread Nicolas Goaziou
Hello,

James Harkins  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



Re: [O] Temp files are not deleted after beamer export with source code blocks

2013-11-06 Thread James Harkins

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



Re: [O] Temp files are not deleted after beamer export with source code blocks

2013-11-06 Thread Nicolas Goaziou
Hello,

James Harkins  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



Re: [O] Temp files are not deleted after beamer export with source code blocks

2013-11-06 Thread James Harkins

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



Re: [O] Temp files are not deleted after beamer export with source code blocks

2013-11-07 Thread Nicolas Goaziou
Hello,

James Harkins  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
>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



Re: [O] Temp files are not deleted after beamer export with source code blocks

2013-11-07 Thread James Harkins

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



Re: [O] Temp files are not deleted after beamer export with source code blocks

2013-11-08 Thread Nicolas Goaziou
Hello,

James Harkins  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