>>>>>> (unless (= 0 (call-process "kpsewhich" nil nil nil "preview.sty")) >>>>>> (display-warning >>>>>> '(org latex-preview preamble-precompilation) >>>>>> "The LaTeX package \"preview\" is required for precompilation, >>>>>> but could not be found") >>>>>> :warning) >>>>> >>>>> This seems out of scope of ox-latex.el >>>> >>>> Not sure how to propagate this error back to org-latex-preview. Please >>>> advise. >>> >>> That's a simple check whether preview.sty exists. Such a check can be >>> done in org-latex-preview itself before even trying to run latex. Is >>> there any problem doing it? >> >> It can't be done before every LaTeX run, that will slow things down. >> How would you arrange to do it once? > > You have > (if-let ((format-file (org-latex-preview--precompile processing-info header > (not > relative-file-p)))) > (setq header (concat "%& " (file-name-sans-extension > format-file))) > (setq precompile-failed-msg > (concat > (format "Precompile failed for buffer %s." > (plist-get processing-info :org-buffer)) > (when-let ((filename (buffer-file-name > (plist-get processing-info > :org-buffer)))) > (format " (File %s)" filename))))) > > So, you already have error handling. > Simply make it more elaborate adding the warning about preview.sty.
I've moved the preview.sty warning to org-latex-preview. Right now, this is the sequence of messages you get if you don't have preview.sty available: Failed to precompile preamble (/tmp/someformatfiledump.fmt), see the "*Org LaTeX Precompilation*" buffer. Precompile failed for buffer myorgfile.org (file myorgfile.org) The LaTeX package "preview" is required for precompilation, but could not be found If kpsewhich itself is not available, the sequence of messages is Failed to precompile preamble (/tmp/someformatfiledump.fmt), see the "*Org LaTeX Precompilation*" buffer. Precompile failed for buffer myorgfile.org (file myorgfile.org) Please ensure that the LaTeX package "preview" is installed Karthik
