From 6b482c4ed58810d2fe855bf9ca9da342d0782b44 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Tue, 8 May 2012 14:20:20 +0200 Subject: [PATCH] org.el: Make sure a file exists before trying to delete it. * org.el (org-create-formula-image-with-dvipng) (org-create-formula-image-with-imagemagick): Make sure a file exists before trying to delete it. Thanks to Benjamin Motz for this idea. --- lisp/org.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index d2a20e785..8ffeee179 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -17248,7 +17248,8 @@ inspection." ;; Use the requested file name and clean up (copy-file pngfile tofile 'replace) (loop for e in '(".dvi" ".tex" ".aux" ".log" ".png" ".out") do - (delete-file (concat texfilebase e))) + (if (file-exists-p (concat texfilebase e)) + (delete-file (concat texfilebase e)))) pngfile)))) (defvar org-latex-to-pdf-process) ;; Defined in org-latex.el @@ -17353,7 +17354,8 @@ inspection." ;; Use the requested file name and clean up (copy-file pngfile tofile 'replace) (loop for e in '(".pdf" ".tex" ".aux" ".log" ".png") do - (delete-file (concat texfilebase e))) + (if (file-exists-p (concat texfilebase e)) + (delete-file (concat texfilebase e)))) pngfile)))) (defun org-splice-latex-header (tpl def-pkg pkg snippets-p &optional extra) -- 2.11.4.GIT