forked from mirrors/org-mode
org-latex-preview: Disable buf precompile on error
* lisp/org-latex-preview.el (org-latex-preview--create-tex-file): When an error occurs during LaTeX precompilation, disable it using `setq-local' and emit an informative warning message.
This commit is contained in:
parent
8ccc93eae1
commit
3d46db577d
|
@ -1492,12 +1492,24 @@ The path of the created LaTeX file is returned."
|
|||
"\n\\usepackage[active,tightpage,auctex]{preview}\n"))
|
||||
(write-region-inhibit-fsync t)
|
||||
(coding-system-for-write buffer-file-coding-system))
|
||||
(when org-latex-preview-use-precompilation
|
||||
(if-let ((format-file (org-latex-preview-precompile processing-info header)))
|
||||
;; Replace header with .fmt file path.
|
||||
(setq header (concat "%& " (file-name-sans-extension format-file)))
|
||||
(display-warning
|
||||
'(org latex-preview disable-local-precompile)
|
||||
(concat "Precompile failed, disabling LaTeX preview precompile in this buffer."
|
||||
"\n To renable, run `(setq-local org-latex-preview-use-precompilation t)' or reopen this buffer."
|
||||
(pcase (plist-get processing-info :latex-processor)
|
||||
("lualatex"
|
||||
"\n LuaLaTeX is known to be problematic, if you might be able to help please get in touch with emacs-orgmode@gnu.org.")
|
||||
("xelatex"
|
||||
;; Note: <https://tex.stackexchange.com/questions/395965/precompile-with-xelatex-and-fontspec> might be helpful.
|
||||
"\n The current XeTeX approach does not support fontspec, if you might be able to help please get in touch with emacs-orgmode@gnu.org."))
|
||||
"\n "))
|
||||
(setq-local org-latex-preview-use-precompilation nil)))
|
||||
(with-temp-file tex-temp-name
|
||||
(insert (if-let ((format-file
|
||||
(and org-latex-preview-use-precompilation
|
||||
(org-latex-preview-precompile processing-info header))))
|
||||
(concat "%& " (file-name-sans-extension format-file))
|
||||
header))
|
||||
(insert header)
|
||||
;; The \abovedisplayskip length must be set after \begin{document} because
|
||||
;; it is usually set during the font size intialisation that occurs at
|
||||
;; \begin{document}. We can either modify the \normalsize command to set
|
||||
|
|
Loading…
Reference in New Issue