From 37a37862a17c4b333164edffbac97f8a56052e88 Mon Sep 17 00:00:00 2001 Message-Id: <37a37862a17c4b333164edffbac97f8a56052e88.1651832231.git.yantar92@gmail.com> From: Ihor Radchenko Date: Fri, 6 May 2022 18:14:05 +0800 Subject: [PATCH] org-html-format-latex: Preserve buffer-local settings * lisp/ox-html.el (org-html-format-latex): Carry over buffer-local variables when create LaTeX images. Use `org-export-with-buffer-copy' instead of `with-temp-buffer'. Fixes https://orgmode.org/list/m2fsqr75md.fsf@ego.team --- lisp/ox-html.el | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lisp/ox-html.el b/lisp/ox-html.el index 81ef002a0..7f2087a46 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -2872,11 +2872,12 @@ (defun org-html-format-latex (latex-frag processing-type info) ;; temporary buffer so that dvipng/imagemagick can properly ;; turn the fragment into an image. (setq latex-frag (concat latex-header latex-frag)))) - (with-temp-buffer - (insert latex-frag) - (org-format-latex cache-relpath nil nil cache-dir nil - "Creating LaTeX Image..." nil processing-type) - (buffer-string)))) + (org-export-with-buffer-copy + (erase-buffer) + (insert latex-frag) + (org-format-latex cache-relpath nil nil cache-dir nil + "Creating LaTeX Image..." nil processing-type) + (buffer-string)))) (defun org-html--wrap-latex-environment (contents _ &optional caption label) "Wrap CONTENTS string within appropriate environment for equations. -- 2.35.1