Subject: bug#376: latex error message starts dired

From: Nate Eldredge <[email-masked]>
Date: Sat, 7 Jun 2008 20:41:43 -0700 (PDT)

In latex mode, when latex produces an error, sometimes using C-x `
(next-error) opens a dired buffer instead of jumping to the error.

Here is a file which reproduces it.

============ snip ==================
\documentclass[12pt]{article}

\usepackage{amsthm}
\usepackage{amsmath}
\newcommand{\polar}{x}
\newcommand{\oldlambda}{xx}

\begin{document}

 \begin{proof}
   
 \begin{align}
 g(\polar, s) &= \Re \phi(se^{i\polar})\frac{1}{4\pi}s
 \psi(i(\pi-se^{i\polar}),\pi-s) \\
 k(\sqrt{\oldlambda}, \polar, s) &= e^{
 \end{align}
 \end{proof}

\end{document}
================ snip ====================

Visit the file with C-x C-f emacs-tex-error.tex
Compile it with C-c C-f
Try to jump to next error with C-x `
You should find yourself in a dired session (at least that's what it
does for me), which is not useful.

Here is the output of latex, as it appears in the *tex-shell* buffer.

================= snip ==================
nate@vulcan:~/bugs$ latex \\nonstopmode\\input emacs-tex-error.tex
This is pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4)
entering extended mode
LaTeX2e <2003/12/01>
Babel <v3.8d> and hyphenation patterns for american, french, german, ngerman, b
ahasa, basque, bulgarian, catalan, croatian, czech, danish, dutch, esperanto, e
stonian, finnish, greek, icelandic, irish, italian, latin, magyar, norsk, polis
h, portuges, romanian, russian, serbian, slovak, slovene, spanish, swedish, tur
kish, ukrainian, nohyphenation, loaded.

(./emacs-tex-error.tex (/usr/local/share/texmf-dist/tex/latex/base/article.cls
Document Class: article 2004/02/16 v1.4f Standard LaTeX document class
(/usr/local/share/texmf-dist/tex/latex/base/size12.clo))
(/usr/local/share/texmf-dist/tex/latex/amscls/amsthm.sty)
(/usr/local/share/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/local/share/texmf-dist/tex/latex/amsmath/amstext.sty
(/usr/local/share/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/usr/local/share/texmf-dist/tex/latex/amsmath/amsbsy.sty)
(/usr/local/share/texmf-dist/tex/latex/amsmath/amsopn.sty))
(./emacs-tex-error.aux)
Runaway argument?
 g(\polar , s) &= \Re \phi (se^{i\polar })\frac {1}{4\pi }s \psi (i(\pi \ETC.
! Paragraph ended before \align was complete.
<to be read again> 
                   \par 
l.21 
     
! Missing $ inserted.
<inserted text> 
                $
l.21 
     
! Missing } inserted.
<inserted text> 
                }
l.21 
     
! Missing \endgroup inserted.
<inserted text> 
                \endgroup 
l.21 
     
! Display math should end with $$.
<to be read again> 
                   \@@par 
l.21 
     
! Extra }, or forgotten \endgroup.
\par ...m \@noitemerr {\@@par }\fi \else {\@@par }
                                                  \fi 
l.21 

! LaTeX Error: \begin{align} on input line 15 ended by \end{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.22 \end{document}
                   
[1] (./emacs-tex-error.aux) )
(\end occurred inside a group at level 2)

### semi simple group (level 2) entered at line 15 (\begingroup)
### semi simple group (level 1) entered at line 13 (\begingroup)
### bottom level
(see the transcript file for additional information)
Output written on emacs-tex-error.dvi (1 page, 276 bytes).
Transcript written on emacs-tex-error.log.
nate@vulcan:~/bugs$ 
===================== snip =====================

Any suggestions appreciated.  Thanks!

In GNU Emacs 22.2.1 (x86_64-pc-freebsd, GTK+ Version 2.12.9)
 of 2008-06-07 on vulcan.lan
Windowing system distributor `The X.Org Foundation', version 11.0.10400000
configured using `configure  '--with-gtk' '--x-libraries=/usr/local/lib' '--x-includes=/usr/local/include' '--prefix=/usr/local' '--mandir=/usr/local/man' '--infodir=/usr/local/info/' 'amd64-freebsd' 'build_alias=amd64-freebsd' 'host_alias=amd64-freebsd' 'target_alias=amd64-freebsd' 'CC=cc' 'CFLAGS=-O2 -fno-strict-aliasing -pipe -march=opteron''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  locale-coding-system: nil
  default-enable-multibyte-characters: t

Major mode: Dired by name

Minor modes in effect:
  shell-dirtrack-mode: t
  tooltip-mode: t
  tool-bar-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  line-number-mode: t

Recent input:
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> C-x C-f ~ b <backspace> / b u g <tab> <tab> 
<tab> e m <tab> <tab> t <tab> <return> C-c C-f C-x 
` <help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <menu-bar> <help-menu> <se
nd-emacs-bug-report>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Making completion list...
Loading help-mode...done
Making completion list...
Loading tex-mode...
Loading regexp-opt...done
Loading tex-mode...done
(No files need saving)
Loading dired...done
Loading emacsbug...done