unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#376: latex error message starts dired
@ 2008-06-08  3:41 Nate Eldredge
  2008-06-08  8:03 ` Ralf Angeli
  0 siblings, 1 reply; 5+ messages in thread
From: Nate Eldredge @ 2008-06-08  3:41 UTC (permalink / raw)
  To: bug-gnu-emacs

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







^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#376: latex error message starts dired
  2008-06-08  3:41 Nate Eldredge
@ 2008-06-08  8:03 ` Ralf Angeli
  2008-06-08  8:33   ` Nate Eldredge
  0 siblings, 1 reply; 5+ messages in thread
From: Ralf Angeli @ 2008-06-08  8:03 UTC (permalink / raw)
  To: Nate Eldredge; +Cc: bug-gnu-emacs, 376

* Nate Eldredge (2008-06-08) writes:

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

> 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.

The parser finds this error and subsequently tries to determine the file
name.  In course of that it checks the "(\pi" construct with point right
before the backslash.  In this case the form
(file-readable-p (thing-at-point 'filename))
returns t and the file name is set to an empty string.  (This is what
`(thing-at-point 'filename)' returns.)

I'm not sure if this is a problem with `thing-at-point' or
`file-readable-p'.

As a workaround you could enable file:line:error messages for latex.

-- 
Ralf






^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#376: latex error message starts dired
  2008-06-08  8:03 ` Ralf Angeli
@ 2008-06-08  8:33   ` Nate Eldredge
  0 siblings, 0 replies; 5+ messages in thread
From: Nate Eldredge @ 2008-06-08  8:33 UTC (permalink / raw)
  To: Ralf Angeli; +Cc: bug-gnu-emacs, 376

On Sun, 8 Jun 2008, Ralf Angeli wrote:

> * Nate Eldredge (2008-06-08) writes:
>
>> Here is the output of latex, as it appears in the *tex-shell* buffer.
>
>> 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.
>
> The parser finds this error and subsequently tries to determine the file
> name.  In course of that it checks the "(\pi" construct with point right
> before the backslash.  In this case the form
> (file-readable-p (thing-at-point 'filename))
> returns t and the file name is set to an empty string.  (This is what
> `(thing-at-point 'filename)' returns.)
>
> I'm not sure if this is a problem with `thing-at-point' or
> `file-readable-p'.
>
> As a workaround you could enable file:line:error messages for latex.

Ah, thanks for the suggestion.  I did not know about that feature.  That 
solves the problem for me.

Thanks for investigating this bug.

-- 

Nate Eldredge
neldredge@math.ucsd.edu







^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#376: latex error message starts dired
@ 2008-07-25 17:35 Chong Yidong
  2008-07-25 17:50 ` Ralf Angeli
  0 siblings, 1 reply; 5+ messages in thread
From: Chong Yidong @ 2008-07-25 17:35 UTC (permalink / raw)
  To: Ralf Angeli; +Cc: 376, Nate Eldredge

>> 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 the output of latex, as it appears in the *tex-shell* buffer.
>>
>> 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.
>
> The parser finds this error and subsequently tries to determine the file
> name.  In course of that it checks the "(\pi" construct with point right
> before the backslash.  In this case the form
> (file-readable-p (thing-at-point 'filename))
> returns t and the file name is set to an empty string.  (This is what
> `(thing-at-point 'filename)' returns.)

How bout the following patch to tex-mode?

*** textmodes/tex-mode.el.~1.213.~	2008-06-25 18:35:53.000000000 -0400
--- textmodes/tex-mode.el	2008-07-25 13:32:46.000000000 -0400
***************
*** 2188,2193 ****
--- 2188,2194 ----
        (let* ((this-error (copy-marker begin-of-error))
  	     (linenum (string-to-number (match-string 1)))
  	     (error-text (regexp-quote (match-string 3)))
+ 	     try-filename
  	     (filename
  	      ;; Prefer --file-liner-error filename if we have it.
  	      (or errfilename
***************
*** 2195,2201 ****
  		    (with-syntax-table tex-error-parse-syntax-table
  		      (backward-up-list 1)
  		      (skip-syntax-forward "(_")
! 		      (while (not (file-readable-p (thing-at-point 'filename)))
  			(skip-syntax-backward "(_")
  			(backward-up-list 1)
  			(skip-syntax-forward "(_"))
--- 2196,2206 ----
  		    (with-syntax-table tex-error-parse-syntax-table
  		      (backward-up-list 1)
  		      (skip-syntax-forward "(_")
! 		      (while (not 
! 			      (and (setq try-filename (thing-at-point
! 						       'filename))
! 				   (not (string= "" try-filename))
! 				   (file-readable-p try-filename)))
  			(skip-syntax-backward "(_")
  			(backward-up-list 1)
  			(skip-syntax-forward "(_"))






^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#376: latex error message starts dired
  2008-07-25 17:35 bug#376: latex error message starts dired Chong Yidong
@ 2008-07-25 17:50 ` Ralf Angeli
  0 siblings, 0 replies; 5+ messages in thread
From: Ralf Angeli @ 2008-07-25 17:50 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 376, Nate Eldredge

* Chong Yidong (2008-07-25) writes:

>> The parser finds this error and subsequently tries to determine the file
>> name.  In course of that it checks the "(\pi" construct with point right
>> before the backslash.  In this case the form
>> (file-readable-p (thing-at-point 'filename))
>> returns t and the file name is set to an empty string.  (This is what
>> `(thing-at-point 'filename)' returns.)
>
> How bout the following patch to tex-mode?

> ! 		      (while (not 
> ! 			      (and (setq try-filename (thing-at-point
> ! 						       'filename))
> ! 				   (not (string= "" try-filename))
> ! 				   (file-readable-p try-filename)))

Looks okay (without actually trying it).  (I'd probably move the `setq'
call into the `string=' call.)  Of course it will still lose if there is
a string after the paren which corresponds to the name of an existing
file, but the chances for that are really slim.

-- 
Ralf






^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-07-25 17:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-25 17:35 bug#376: latex error message starts dired Chong Yidong
2008-07-25 17:50 ` Ralf Angeli
  -- strict thread matches above, loose matches on Subject: below --
2008-06-08  3:41 Nate Eldredge
2008-06-08  8:03 ` Ralf Angeli
2008-06-08  8:33   ` Nate Eldredge

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).