From 2835c96dcf8ae97d35726da5f5403ad2d4955b01 Mon Sep 17 00:00:00 2001 From: Karthik Chikmagalur Date: Fri, 21 Apr 2023 22:04:29 -0700 Subject: [PATCH] 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. --- lisp/org-latex-preview.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/org-latex-preview.el b/lisp/org-latex-preview.el index e7f1f04ce..caec678e2 100644 --- a/lisp/org-latex-preview.el +++ b/lisp/org-latex-preview.el @@ -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)