emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Francesco Pizzolante" <fpz-djc/iPCCuDYQheJpep6IedvLeJWuRmrY@public.gmane.org>
To: Nicolas Goaziou <n.goaziou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: mailing-list-org-mode
	<public-emacs-orgmode-mXXj517/zsQ-wOFGN7rlS/M9smdsby/KFg@public.gmane.org>,
	Francesco Pizzolante
	<public-fpz-djc/iPCCuDYQheJpep6IedvLeJWuRmrY-wOFGN7rlS/M9smdsby/KFg@public.gmane.org>
Subject: Re: [PATCH] Add catch-up all LaTeX errors
Date: Wed, 26 Mar 2014 16:39:26 +0100	[thread overview]
Message-ID: <87mwgdgea9.fsf@somewhere.org> (raw)
In-Reply-To: <87zjkdt3le.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> (Nicolas Goaziou's message of "Wed, 26 Mar 2014 15:51:57 +0100")



Hi Nicolas,

Thanks for your answer.

>>> As an example, if you open the target PDF file with Adobe Reader and, in the
>>> meantime, you export your Org file again to PDF, you'll see that Org will
>>> tell
>>> you it's OK (Process Completed) while, if you look at the *Org PDF LaTeX
>>> Output* buffer, you'll see an error such as:
>>>
>>> ! I can't write on file `toto.pdf'.
>>> [...]
>>>
>>> The problem comes from the fact that Org just checks for a couple of error
>>> messages (defined in org-latex-known-errors) and report it's OK if it
>>> doesn't find those messages:
>
> Errors are not related to your problem. Actually, "ox-latex.el" uses
> a rather weak check to know if process was successful or not:
>
>   (if (not (file-exists-p pdffile))
>       (error (concat (format "PDF file %s wasn't produced" pdffile)
>                      (when errors (concat ": " errors))))
>     ...
>     (message (concat "Process completed"
>                      (if (not errors) "." (concat " with errors: " errors)))))
>
> IOW, it cannot tell the difference between a successful export and an
> export failure with an already existing PDFFILE.

This is not true as this code checks for the `errors' variable in all
cases. With an already existing PDFFILE, you will end up with this
message: 'Process completed with errors: ...'.

From my point of view, the issue comes from the fact that the `errors'
variable is not correctly filled in with errors from the LaTeX log file.

As you can see in the following code, we do not catch error lines
starting with '!' but *only* those starting with '! LaTeX...' and '!
Package...':

--8<---------------cut here---------------start------------->8---
(defcustom org-latex-known-errors
  '(("Reference.*?undefined" .  "[undefined reference]")
    ("Citation.*?undefined" .  "[undefined citation]")
    ("Undefined control sequence" .  "[undefined control sequence]")
    ("^! LaTeX.*?Error" .  "[LaTeX error]")
    ("^! Package.*?Error" .  "[package error]")
    ("Runaway argument" .  "Runaway argument"))
[...]
--8<---------------cut here---------------end--------------->8---

While the wikibooks reference
(http://en.wikibooks.org/wiki/LaTeX/Errors_and_Warnings) tells that to
be sure to catch *all* errors, we have to check for any line beginning
with '!'.

Then, in the case where the `errors' variable would effectively contain
any error from the log file, the code you mention above would work in
any case.

That's why I started with this patch (*and it works*):

---
 lisp/ox-latex.el |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 9262ded..2cffe38 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -862,7 +862,8 @@ logfiles to remove, set `org-latex-logfiles-extensions'."
     ("Undefined control sequence" .  "[undefined control sequence]")
     ("^! LaTeX.*?Error" .  "[LaTeX error]")
     ("^! Package.*?Error" .  "[package error]")
-    ("Runaway argument" .  "Runaway argument"))
+    ("Runaway argument" .  "Runaway argument")
+    ("^!.*" . "[Unknown error]"))
   "Alist of regular expressions and associated messages for the user.
 The regular expressions are used to find possible errors in the
 log of a latex-run."
--
1.7.9

The only issue is that the error reporting is not really helpfull (as my
current patch only reports 'Unknown error' for any other error).

Any suggestion is welcome.

Best regards,
 Francesco

  parent reply	other threads:[~2014-03-26 15:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-11  8:11 [PATCH] Add catch-up all LaTeX errors Francesco Pizzolante
     [not found] ` <87vc14i5wp.fsf-oHC15RC7JGTNLxjTenLetw@public.gmane.org>
2014-03-26 14:36   ` Francesco Pizzolante
2014-03-26 14:51     ` Nicolas Goaziou
     [not found]       ` <87zjkdt3le.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-03-26 15:39         ` Francesco Pizzolante [this message]
2014-03-26 16:12           ` Nicolas Goaziou
2014-03-26 18:55             ` Sebastien Vauban
2014-03-27 10:02               ` Nicolas Goaziou
2014-03-27 10:17                 ` Sebastien Vauban
2014-03-28 10:59                   ` Nicolas Goaziou
2014-03-28 13:53                     ` Sebastien Vauban
     [not found]             ` <87vbv1szuv.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-03-27 10:19               ` Francesco Pizzolante
2014-03-26 22:33       ` Charles Millar
     [not found]         ` <533355BA.1030003-H+0wwilmMs3R7s880joybQ@public.gmane.org>
2014-03-27 10:27           ` Francesco Pizzolante
2014-03-28  4:40         ` Marcin Borkowski
2014-03-28  8:14           ` Francesco Pizzolante

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mwgdgea9.fsf@somewhere.org \
    --to=fpz-djc/ipccudyqhejpep6iedvlejwurmry@public.gmane.org \
    --cc=n.goaziou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=public-emacs-orgmode-mXXj517/zsQ-wOFGN7rlS/M9smdsby/KFg@public.gmane.org \
    --cc=public-fpz-djc/iPCCuDYQheJpep6IedvLeJWuRmrY-wOFGN7rlS/M9smdsby/KFg@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).