org-latex-preview: Respect auto-generate option

* lisp/org-latex-preview.el (org-latex-preview-auto--detect-fragments-in-change):
Respect the user option `org-latex-preview-auto-generate' when
`org-latex-preview-auto-mode' is active.  (This was lost when the
auto-generation code was rewritten.)
This commit is contained in:
Karthik Chikmagalur 2023-01-21 12:59:51 -08:00 committed by TEC
parent 5ca232e8ea
commit 1323115972
Signed by: tec
SSH Key Fingerprint: SHA256:eobz41Mnm0/iYWBvWThftS0ElEs1ftBr6jamutnXc/A
1 changed files with 57 additions and 56 deletions

View File

@ -598,6 +598,7 @@ This is intended to be placed in `post-command-hook'."
(defun org-latex-preview-auto--detect-fragments-in-change (beg end _)
"Examine the content between BEG and END, and preview LaTeX fragments found."
(when org-latex-preview-auto-generate
(let ((initial-point (point))
fragments)
(save-excursion
@ -655,7 +656,7 @@ This is intended to be placed in `post-command-hook'."
end nil))))
(org-latex-preview--create
org-latex-preview-default-process
fragments))))
fragments)))))
(defun org-latex-preview-auto--maybe-track-element-here (type pos)
"Check for an org element of TYPE at `point' and ensure an overlay exists.