From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Sebastien Vauban" Subject: Displaying errors in batch mode Date: Wed, 31 Oct 2012 09:55:35 +0100 Message-ID: <808vanf2bc.fsf@somewhere.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org-mXXj517/zsQ@public.gmane.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org-mXXj517/zsQ@public.gmane.org To: emacs-orgmode-mXXj517/zsQ@public.gmane.org Hello, Errors generated by Org are correctly reported in batch mode: #+begin_src sh emacs --batch -Q --eval "(add-to-list 'load-path \"~/src/org-mode/lisp\")" --eval "(add-to-list 'load-path \"~/src/org-mode/contrib/lisp\")" -l "~/src/org-batch/bin/org-batch-init.el" ecm.txt -f org-export-as-pdf #+end_src LaTeX errors sometimes well, sometimes not at all: you only know that there were errors, and that the PDF file has not been produced. No more. And this seems hard to reproduce (whether or not you get the LaTeX errors displayed). Maybe you have some hints? * ECM "Org error" #+begin_src org ,#+TITLE: ECM No error reported ,#+LANGUAGE: en ,#+LaTeX_CLASS: myarticle ,* Example Blah blah... #+end_src will results in: #+begin_example Exporting to PDF... Exporting to LaTeX... Debugger entered--Lisp error: (error "No definition for class `myarticle' in `org-export-latex-classes'") signal(error ("No definition for class `myarticle' in `org-export-latex-classes'")) error("No definition for class `%s' in `org-export-latex-classes'" "myarticle") (or (car (assoc org-export-latex-class org-export-latex-classes)) (error "No definition for class `%s' in `org-export-latex-classes'" org-export-latex-class)) #+end_example which is *crystal-clear*. * ECM "LaTeX error" (invalid syntax used for comments) #+begin_src org ,#+TITLE: ECM No error reported ,#+LANGUAGE: en ,##+LaTeX_CLASS: myarticle ,* Example Blah blah... #+end_src sometimes results in: #+begin_example Exporting to PDF... Exporting to LaTeX... Saving file d:/home/sva/src/org-batch/ecm.tex... Wrote d:/home/sva/src/org-batch/ecm.tex Saving file d:/home/sva/src/org-batch/ecm.tex... Wrote d:/home/sva/src/org-batch/ecm.tex LaTeX export done, pushed to kill ring and clipboard Processing LaTeX file d:/home/sva/src/org-batch/ecm.tex... Latexmk: This is Latexmk, John Collins, 30 March 2012, version: 4.31. **** Report bugs etc to John Collins . **** Rule 'pdflatex': Rules & subrules not known to be previously run: pdflatex Rule 'pdflatex': The following rules & subrules became out-of-date: 'pdflatex' ------------ Run number 1 of rule 'pdflatex' ------------ ------------ Running 'pdflatex -recorder "d:/home/sva/src/org-batch/ecm.tex"' ------------ Latexmk: applying rule 'pdflatex'... This is pdfTeX, Version 3.1415926-2.3-1.40.12 (Web2C 2011) [...] ! Missing $ inserted. $ l.39 \#\#+\LaTeX{}_ CLASS: myarticle ? ! Emergency stop. $ l.39 \#\#+\LaTeX{}_ CLASS: myarticle ! ==> Fatal error occurred, no output PDF file produced! Transcript written on ecm.log. Failure to make 'ecm.pdf' Collected error summary (may duplicate other messages): pdflatex: Command for 'pdflatex' gave return code 256 Latexmk: Use the -f option to force complete processing. Latexmk: Errors, so I did not complete making targets D:\texlive\2011\bin\win32\runscript.tlu:587: command failed with exit code 12: perl.exe d:/texlive/2011/texmf-dist/scripts/latexmk/latexmk.pl -pdf d:/home/sva/src/org-batch/ecm.tex Processing LaTeX file d:/home/sva/src/org-batch/ecm.tex...done Debugger entered--Lisp error: (error "PDF file d:/home/sva/src/org-batch/ecm.pdf was not produced") signal(error ("PDF file d:/home/sva/src/org-batch/ecm.pdf was not produced")) error("PDF file d:/home/sva/src/org-batch/ecm.pdf was not produced") (if (not (file-exists-p pdffile)) (error (concat "PDF file " pdffile " was not produced" (if errors (concat ":" errors "") ""))) (set-window-configuration wconfig) (if org-export-pdf-remove-logfiles (progn (progn (let ((--dolist-tail-- org-export-pdf-logfiles) ext) (while --dolist-tail-- (setq ext (car --dolist-tail--)) (setq file (concat base "." ext)) (and (file-exists-p file) (delete-file file)) (setq --dolist-tail-- (cdr --dolist-tail--))))))) (message (concat "Exporting to PDF...done" (if errors (concat ", with some errors:" errors) ""))) pdffile) #+end_example That is, the LaTeX error is well displayed... Very clear. * ECM "LaTeX error" (undefined environment) #+begin_src org ,#+TITLE: ECM No error reported ,#+LANGUAGE: en ,* Example ,#+LaTeX: {\begin{mychangemargin}{-2.5cm}{0cm} Blah blah... ,#+LaTeX: \end{mychangemargin}} #+end_src sometimes results in: #+begin_example Exporting to PDF... Exporting to LaTeX... Saving file d:/home/sva/src/org-batch/ecm.tex... Wrote d:/home/sva/src/org-batch/ecm.tex Saving file d:/home/sva/src/org-batch/ecm.tex... Wrote d:/home/sva/src/org-batch/ecm.tex LaTeX export done, pushed to kill ring and clipboard Processing LaTeX file d:/home/sva/src/org-batch/ecm.tex... Latexmk: This is Latexmk, John Collins, 30 March 2012, version: 4.31. **** Report bugs etc to John Collins . **** Rule 'pdflatex': File changes, etc: Changed files, or newly in use since previous run(s): 'd:/home/sva/src/org-batch/ecm.tex' 'ecm.aux' Non-existent destination files: 'ecm.pdf' ------------ Run number 1 of rule 'pdflatex' ------------ ------------ Running 'pdflatex -recorder "d:/home/sva/src/org-batch/ecm.tex"' ------------ Latexmk: applying rule 'pdflatex'... This is pdfTeX, Version 3.1415926-2.3-1.40.12 (Web2C 2011) [...] ! LaTeX Error: Environment mychangemargin undefined. See the LaTeX manual or LaTeX Companion for explanation. Type H for immediate help. ... l.43 {\begin{mychangemargin} {-2.5cm}{0cm} ? ! Emergency stop. ... l.43 {\begin{mychangemargin} {-2.5cm}{0cm} ! ==> Fatal error occurred, no output PDF file produced! Transcript written on ecm.log. Failure to make 'ecm.pdf' Collected error summary (may duplicate other messages): pdflatex: Command for 'pdflatex' gave return code 256 Latexmk: Use the -f option to force complete processing. Latexmk: Errors, so I did not complete making targets D:\texlive\2011\bin\win32\runscript.tlu:587: command failed with exit code 12: perl.exe d:/texlive/2011/texmf-dist/scripts/latexmk/latexmk.pl -pdf d:/home/sva/src/org-batch/ecm.tex Processing LaTeX file d:/home/sva/src/org-batch/ecm.tex...done Debugger entered--Lisp error: (error "PDF file d:/home/sva/src/org-batch/ecm.pdf was not produced") signal(error ("PDF file d:/home/sva/src/org-batch/ecm.pdf was not produced")) error("PDF file d:/home/sva/src/org-batch/ecm.pdf was not produced") (if (not (file-exists-p pdffile)) (error (concat "PDF file " pdffile " was not produced" (if errors (concat ":" errors "") ""))) (set-window-configuration wconfig) (if org-export-pdf-remove-logfiles (progn (progn (let ((--dolist-tail-- org-export-pdf-logfiles) ext) (while --dolist-tail-- (setq ext (car --dolist-tail--)) (setq file (concat base "." ext)) (and (file-exists-p file) (delete-file file)) (setq --dolist-tail-- (cdr --dolist-tail--))))))) (message (concat "Exporting to PDF...done" (if errors (concat ", with some errors:" errors) ""))) pdffile) #+end_example which is clear as well. * Some other times Some other times (I can't reproduce it right now), *with the above examples*, we only get such a reporting: #+begin_example Exporting to PDF... Exporting to LaTeX... Saving file d:/home/sva/src/org-batch/ecm-no-error-reported.tex... Wrote d:/home/sva/src/org-batch/ecm-no-error-reported.tex Saving file d:/home/sva/src/org-batch/ecm-no-error-reported.tex... Wrote d:/home/sva/src/org-batch/ecm-no-error-reported.tex LaTeX export done, pushed to kill ring and clipboard Processing LaTeX file d:/home/sva/src/org-batch/ecm-no-error-reported.tex... Processing LaTeX file d:/home/sva/src/org-batch/ecm-no-error-reported.tex...done Debugger entered--Lisp error: (error "PDF file d:/home/sva/src/org-batch/ecm-no-error-reported.pdf was not produced") signal(error ("PDF file d:/home/sva/src/org-batch/ecm-no-error-reported.pdf was not produced")) error("PDF file d:/home/sva/src/org-batch/ecm-no-error-reported.pdf was not produced") (if (not (file-exists-p pdffile)) (error (concat "PDF file " pdffile " was not produced" (if errors (concat ":" errors "") ""))) (set-window-configuration wconfig) (if org-export-pdf-remove-logfiles (progn (progn (let ((--dolist-tail-- org-export-pdf-logfiles) ext) (while --dolist-tail-- (setq ext (car --dolist-tail--)) (setq file (concat base "." ext)) (and (file-exists-p file) (delete-file file)) (setq --dolist-tail-- (cdr --dolist-tail--))))))) (message (concat "Exporting to PDF...done" (if errors (concat ", with some errors:" errors) ""))) pdffile) #+end_example That is clearly lacking the sought information. However, I can't give an accurate recipe of how to get a LaTeX error correctly reported or not. Did you already get such troubles? Best regards, Seb -- Sebastien Vauban