From 33c79f8e0ea1e2fa974ffa9dff6d952e8676a753 Mon Sep 17 00:00:00 2001 From: Karthik Chikmagalur Date: Fri, 21 Apr 2023 22:10:41 -0700 Subject: [PATCH] org-latex-preview: Ensure fmt file cache is cleared * lisp/org-latex-preview.el (org-latex-preview-clear-cache): When running `org-latex-preview-clear-cache', the precompiled format file is only removed from the `org-persist' cache if the preamble has been cached in the current buffer. We require the format file to always be unregistered from the cache, so generate the preamble if necessary so it can be hashed and used as the key to find the corresponding format file in the cache. --- lisp/org-latex-preview.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/org-latex-preview.el b/lisp/org-latex-preview.el index 458b19a52..e7f1f04ce 100644 --- a/lisp/org-latex-preview.el +++ b/lisp/org-latex-preview.el @@ -2023,11 +2023,15 @@ the *entire* preview cache will be cleared, and `org-persist-gc' run." (t (list nil nil)))))) ;; Clear the precompile cache if clearing the whole buffer or everything. (when (or clear-entire-cache (not (or beg end))) + (or org-latex-preview--preamble-content + (setq org-latex-preview--preamble-content + (org-latex-preview--get-preamble))) (dolist (compiler org-latex-compilers) (org-latex--remove-cached-preamble compiler org-latex-preview--preamble-content nil) (org-latex--remove-cached-preamble - compiler org-latex-preview--preamble-content t))) + compiler org-latex-preview--preamble-content t)) + (org-latex-preview--clear-preamble-cache)) (org-latex-preview-clear-overlays beg end) (if clear-entire-cache (let ((n 0))