From 52fd5cabea8caea72a27e3a9a6c60d6ecd219b25 Mon Sep 17 00:00:00 2001 From: Karthik Chikmagalur Date: Wed, 1 Mar 2023 00:28:07 -0800 Subject: [PATCH] org-latex-preview: Clean up tex file on failure * lisp/org-latex-preview.el (org-latex-preview--create-image-async): Ensure that the latex-preview cleanup callback runs when the preview image extraction process fails. This is to avoid littering the default-directory with temporary tex files. --- lisp/org-latex-preview.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/org-latex-preview.el b/lisp/org-latex-preview.el index 7a5e2c27c..793d6dd25 100644 --- a/lisp/org-latex-preview.el +++ b/lisp/org-latex-preview.el @@ -1377,7 +1377,8 @@ Returns a list of async tasks started." (list #'org-latex-preview--failure-callback (format "Creating LaTeX preview images failed (exit code %%d). Please see %s for details" - (propertize org-latex-preview--image-log 'face 'warning)))) + (propertize org-latex-preview--image-log 'face 'warning)) + #'org-latex-preview--cleanup-callback)) (pcase processing-type ('dvipng (plist-put (cddr img-extract-async) :filter