Please find attached some documentation updates (comments and docstrings) for org-latex-preview.el and ox-latex.el.
Karthik
>From e6f344f28d264476ff323a45969c7f40e9cce830 Mon Sep 17 00:00:00 2001 From: Karthik Chikmagalur <[email protected]> Date: Sun, 18 Oct 2026 01:16:27 -0700 Subject: [PATCH] org-latex-preview: Update documentation * lisp/org-latex-preview.el (org-latex-preview-overlay-update-functions): Warn that the overlay buffer may not be current when this hook is called. * lisp/ox-latex.el (org-latex-precompile): Clarify that this does not affect xelatex and lualatex. (org-latex-make-preamble): Comment explaining heuristic for trying to create reusable format precompile dumps. --- lisp/org-latex-preview.el | 5 +++-- lisp/ox-latex.el | 10 +++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lisp/org-latex-preview.el b/lisp/org-latex-preview.el index 9a18ad289..adb31cff4 100644 --- a/lisp/org-latex-preview.el +++ b/lisp/org-latex-preview.el @@ -333,8 +333,9 @@ (defcustom org-latex-preview-process-finish-functions nil (defcustom org-latex-preview-overlay-update-functions nil "Abnormal hook run after a preview overlay is updated. -Each function in this hook is called with one argument, the -overlay that was updated." +Each function in this hook is called with one argument, the overlay that +was updated. The overlay's buffer may not be current when the hook is +called." :group 'org-latex-preview :type 'hook) diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index 59170e687..d5d639191 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -2266,7 +2266,10 @@ (defcustom org-latex-precompile nil "Whether to precompile the preamble during export. LaTeX export can be considerably faster with a precompiled preamble. -This requires the LaTeX package \"mylatexformat\" to be installed." +This requires the LaTeX package \"mylatexformat\" to be installed. + +When using xelatex or lualatex, precompilation is disabled and this +option has no effect." :group 'org-export-latex :package-version '(Org . "10.0") :type 'boolean @@ -2343,6 +2346,11 @@ (defun org-latex-make-preamble (info &optional template snippet?) (setf (buffer-local-value 'org-latex-precompile (get-buffer input-buffer)) nil))) + ;; Heuristic: precompile in a temporary directory + ;; so we can reuse the format dump across LaTeX + ;; files, unless we see an input or include + ;; statement in the preamble. This can have false + ;; negatives. (org-latex--precompile info preamble (string-match-p "\\(?:\\\\input{\\|\\\\include{\\)[^/]" preamble)))))) -- 2.55.0
