org-latex-preview: Allow setting persist expiry

* lisp/org-latex-preview.el (org-latex-preview--cache-image,
org-latex-preview-persist-expiry): Introduce a new variable
`org-latex-preview-persist-expiry' which is used within
`org-latex-preview--cache-image' as the expiry value when calling
`org-persist-register' on preview data.
This commit is contained in:
TEC 2023-01-17 23:43:00 +08:00
parent 3a585e28a1
commit c19eadcf20
Signed by: tec
SSH Key Fingerprint: SHA256:eobz41Mnm0/iYWBvWThftS0ElEs1ftBr6jamutnXc/A
1 changed files with 11 additions and 0 deletions

View File

@ -238,6 +238,16 @@ of the Emacs session."
:package-version '(Org . "9.7")
:type 'boolean)
(defcustom org-latex-preview-persist-expiry 7
"A homologue of `org-persist-default-expiry' for preview data.
This is only relevant when `org-latex-preview-persist' is non-nil."
:group 'org-latex
:package-version '(Org . "9.7")
:type '(choice (const :tag "Never" never)
(const :tag "Always" nil)
(number :tag "Keep N days")
(function :tag "Function")))
(defcustom org-latex-preview-numbered nil
"Whether to calculate and apply correct equation numbering."
:group 'org-latex
@ -1774,6 +1784,7 @@ enabled, see `org-latex-preview-persist'."
(file ,path)
(elisp-data ,info))
(list :key key)
:expiry org-latex-preview-persist-expiry
:write-immediately t))))
(cons (cadr label-path-info) info))
(unless org-latex-preview--table