forked from mirrors/org-mode
ox-latex: Handle preamble temp-ness explicitly
* lisp/ox-latex.el (org-latex--precompile, org-latex-make-preamble): Instead of detecting relative file includes within `org-latex--precompile', have an optional argument to signal a file can be safely compile in the tempdir. Move the check to `org-latex-make-preamble' when calling `org-latex--precompile'.
This commit is contained in:
parent
52fd5cabea
commit
96dc874f91
|
@ -2130,7 +2130,9 @@ specified in `org-latex-default-packages-alist' or
|
||||||
"\n"))
|
"\n"))
|
||||||
(format-file
|
(format-file
|
||||||
(and org-latex-precompile
|
(and org-latex-precompile
|
||||||
(org-latex--precompile info preamble))))
|
(org-latex--precompile
|
||||||
|
info preamble
|
||||||
|
(string-match-p "\\(?:\\\\input{\\|\\\\include{\\)[^/]" preamble)))))
|
||||||
(when (and format-file (not snippet?))
|
(when (and format-file (not snippet?))
|
||||||
(let ((preamble-parts (split-string preamble (regexp-quote header-split))))
|
(let ((preamble-parts (split-string preamble (regexp-quote header-split))))
|
||||||
(setq preamble (car preamble-parts)
|
(setq preamble (car preamble-parts)
|
||||||
|
@ -2236,12 +2238,16 @@ This requires the LaTeX package \"mylatexformat\" to be installed.")
|
||||||
("xelatex" . "xelatex -no-pdf")
|
("xelatex" . "xelatex -no-pdf")
|
||||||
("lualatex" . "dvilualatex")))
|
("lualatex" . "dvilualatex")))
|
||||||
|
|
||||||
(defun org-latex--precompile (info preamble)
|
(defun org-latex--precompile (info preamble &optional tempfile-p)
|
||||||
"Precompile/dump LaTeX PREAMBLE text.
|
"Precompile/dump LaTeX PREAMBLE text.
|
||||||
|
|
||||||
The path to the format file (.fmt) is returned. If the format
|
The path to the format file (.fmt) is returned. If the format
|
||||||
file could not be found in the persist cache, it is generated
|
file could not be found in the persist cache, it is generated
|
||||||
according to PROCESSING-INFO and stored.
|
according to PROCESSING-INFO and stored. INFO is a plist used as
|
||||||
|
a communication channel.
|
||||||
|
|
||||||
|
If TEMPFILE-P is non-nil, then it is assumed the preamble does
|
||||||
|
not contain any relative references to other files.
|
||||||
|
|
||||||
This is intended to speed up Org's LaTeX preview generation
|
This is intended to speed up Org's LaTeX preview generation
|
||||||
process."
|
process."
|
||||||
|
@ -2250,10 +2256,11 @@ process."
|
||||||
preamble
|
preamble
|
||||||
(concat
|
(concat
|
||||||
(plist-get info :latex-compiler)
|
(plist-get info :latex-compiler)
|
||||||
(and (string-match-p "\\(?:\\\\input{\\|\\\\include{\\)"
|
(if tempfile-p "-temp"
|
||||||
preamble)
|
default-directory))
|
||||||
default-directory))
|
(sha1)))
|
||||||
(sha1))))
|
(default-directory
|
||||||
|
(if tempfile-p temporary-file-directory default-directory)))
|
||||||
(or (cadr
|
(or (cadr
|
||||||
(org-persist-read "LaTeX format file cache"
|
(org-persist-read "LaTeX format file cache"
|
||||||
(list :key preamble-hash)
|
(list :key preamble-hash)
|
||||||
|
|
Loading…
Reference in New Issue