From 0549f0f55f54cbaecdd24478fed462e1a3f63f02 Mon Sep 17 00:00:00 2001 From: Karthik Chikmagalur Date: Sun, 14 May 2023 17:06:28 -0700 Subject: [PATCH] org-latex-preview: Fix clear-cache command * lisp/org-latex-preview.el (org-latex-preview-clear-cache): When clearing the preview cache, clear the cached preamble after clearing the image cache, since the preamble is used to compute the image hashes. --- lisp/org-latex-preview.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lisp/org-latex-preview.el b/lisp/org-latex-preview.el index e221432d4..fc4108a79 100644 --- a/lisp/org-latex-preview.el +++ b/lisp/org-latex-preview.el @@ -2119,8 +2119,7 @@ the *entire* preview cache will be cleared, and `org-persist-gc' run." (org-latex--remove-cached-preamble compiler org-latex-preview--preamble-content nil) (org-latex--remove-cached-preamble - compiler org-latex-preview--preamble-content t)) - (org-latex-preview--clear-preamble-cache)) + compiler org-latex-preview--preamble-content t))) (org-latex-preview-clear-overlays beg end) (if clear-entire-cache (let ((n 0)) @@ -2162,7 +2161,9 @@ the *entire* preview cache will be cleared, and `org-persist-gc' run." org-latex-preview--preamble-content value imagetype fg bg number)))) (message "Cleared LaTeX preview cache for %s." - (if (or beg end) "region" "buffer"))))) + (if (or beg end) "region" "buffer")))) + (when (or clear-entire-cache (not (or beg end))) + (org-latex-preview--clear-preamble-cache))) (defun org-latex-preview-precompile (processing-info preamble &optional tempfile-p) "Precompile/dump LaTeX PREAMBLE text.