bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

tex-compilation-parse-errors misses new-style error messages


From: Joe Wells
Subject: tex-compilation-parse-errors misses new-style error messages
Date: Mon, 10 Sep 2007 05:51:07 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

Many distributed implementations of TeX are based on the Web2c port.
Since Web2c version 7.3.5 released in 2001-11, the main programs like
“tex”, “latex”, etc., have supported FILE:LINE:ERROR style error
messages.  In the current versions, this style of error messages is
enabled with the “--file-line-error” command-line option.

To explain the difference, here is an example of an old-style error
message:

-----------------------------------------------------------------

(./test2.tex
[ ... I've omitted parts of the TeX output here ... ]
(/usr/share/texmf-tetex/tex/latex/base/article.cls
[ ... I've omitted more stuff here ... ]
(/usr/share/texmf-tetex/tex/latex/base/size10.clo)) (./test2.aux)
! Too many }'s.
l.14   xyz }
                    abc def ghi
-----------------------------------------------------------------

Notice how the file name of the error (./test2.tex) needs to be found
from the messages preceding the error message by scanning parentheses.

Here is the corresponding new-style error message obtained when
FILE:LINE:ERROR style error messages are enabled:

-------------------------------
(./test2.tex
[ ... I've omitted parts of the TeX output here ... ]
(/usr/share/texmf-tetex/tex/latex/base/article.cls
[ ... I've omitted more stuff here ... ]
(/usr/share/texmf-tetex/tex/latex/base/size10.clo)) (./test2.aux)
./test2.tex:14: Too many }'s.
l.14   xyz }
                    abc def ghi
-------------------------------

The tex-compilation-parse-errors function fails to find error messages
if FILE:LINE:ERROR style error messages are enabled.  This should be
easy to fix.  The regexp

  "^! "

in tex-compilation-parse-errors should be replace by a regexp like the
following one:

  "^\\(?:[^:\n]+:[[:digit:]]+:\\|!\\) "

This will find both old-style and new-style error messages.

The characters in the character alternative [^:\n] need to match any
characters that might appear in a pathname of a file input by TeX.

An additional change that might be made is to use the file name
matched by my suggested regexp when a new-style error message is seen.
The code in tex-compilation-parse-errors can usually figure out the
file name from the context of the error message, but the name on the
error message line itself is more likely to be accurate.  (There is no
need to try to use the line number, as it is repeated on the next line
and tex-compilation-parse-errors already finds it there.)

Note that it would be wrong to “fix” this by switching to using
compilation-error-regexp-alist (and
compilation-error-regexp-alist-alist).  The reason is that
tex-compilation-parse-errors has special code for finding the correct
source file and line within the file when a temporary file is being
used by tex-region or tex-buffer.  Also, tex-compilation-parse-errors
knows how to find the correct column by looking at the two lines after
the error message.

I hope this report is helpful.

Joe

======================================================================
In GNU Emacs 22.1.1 (i686-pc-linux-gnu, GTK+ Version 2.8.20)
 of 2007-06-27 on artemis
Windowing system distributor `The X.Org Foundation', version 11.0.70000000
configured using `configure  '--prefix=/home/jbw/local2' '--enable-debug' 
'--disable-nls' '--with-x-toolkit=gtk' 'CFLAGS=-O0 -g3 -ggdb''




reply via email to

[Prev in Thread] Current Thread [Next in Thread]