org-latex-preview: Fix startup preamble generation

* lisp/org-latex-preview.el (org-latex-preview--get-preamble):
When `org-startup-with-latex-preview' (or the `#+startup:
latexpreview') option is set, preamble generation and
precompilation fail as latex previews are generated in the clone
of the current buffer created by `org-export-with-buffer-copy'.
This is because org-mode is turned on in the cloned buffer, which
requires creating LaTeX previews there.  Not only is this
unnecessary, it causes a flurry of errors since the cloned buffer
is killed before the previews can be placed.  Explicitly avoid
org-startup-* tasks in the cloned buffer when generating the LaTeX
preamble for our main Org buffer.
This commit is contained in:
Karthik Chikmagalur 2023-04-21 22:04:29 -07:00 committed by TEC
parent 33c79f8e0e
commit 2835c96dcf
Signed by: tec
SSH Key Fingerprint: SHA256:eobz41Mnm0/iYWBvWThftS0ElEs1ftBr6jamutnXc/A
1 changed files with 2 additions and 1 deletions

View File

@ -1346,7 +1346,8 @@ previews."
"Obtain the LaTeX preview for snippet preview in BUF."
(with-current-buffer (or buf (current-buffer))
(org-fold-core-ignore-modifications
(let ((info (org-combine-plists
(let ((org-inhibit-startup t)
(info (org-combine-plists
(org-export--get-export-attributes
(org-export-get-backend 'latex))
(org-export--get-buffer-attributes)