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.
This commit is contained in:
Karthik Chikmagalur 2023-04-21 22:10:41 -07:00 committed by TEC
parent 7bd5973233
commit 33c79f8e0e
Signed by: tec
SSH Key Fingerprint: SHA256:eobz41Mnm0/iYWBvWThftS0ElEs1ftBr6jamutnXc/A
1 changed files with 5 additions and 1 deletions

View File

@ -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))