[ESS] Sweave: focus after `M-n P'

Patrick Drechsler patrick at pdrechsler.de
Wed May 2 23:25:43 CEST 2007


Hi,

when invoking `M-n s' on foo.Rnw and everything is OK one normally
then parses the result (foo.tex) through (pdf)latex with `M-n l' or
`M-n P'.

Failing an interface between ESS and AUCTeX, I think it would be a
good idea to place the "cursor focus" at the end of the *Shell Command
Output Buffer* instead of the empty *Async Shell Command* buffer.

Let me try to show using a minimal example:

1. Save this as ~/tmp/foo.Rnw:

--8<---------------cut here---------------start------------->8---
\documentclass{article}
\begin{document}
\section{Intro}
\label{sec:intro}
some text some \emph{bold} text.
\end{document}
--8<---------------cut here---------------end--------------->8---

2. Start R with `M-x R' and switch back to the foo.Rnw buffer[1].
3. `M-n s'
4. `M-n P'

Everything is fine.

5. Now include a small syntax error by deleting the closing bracket after
`\label' so your foo.Rnw file looks like this:

--8<---------------cut here---------------start------------->8---
\documentclass{article}
\begin{document}
\section{Intro}
\label{sec:intro
some text some \emph{bold} text.
\end{document}
--8<---------------cut here---------------end--------------->8---

6. `M-n s'
7. 'M-n P'

The PDF file which is displayed is the same as after step 4. The user
will not see that the command `M-n P' had an error message. 

Why? 

At this time the standard Emacs screen is split in two: The top part
showing the source buffer code of `foo.Rnw', the bottom part showing
an empty buffer called *Async Shell Command*.

Switching to the end of the *Shell Command Output* buffer one gets
this:

,----
| ))
| Runaway argument?
| {sec:intro some text some \emph {bold} text. \end {document} 
| ! File ended while scanning use of \label.
| <inserted text> 
|                 \par 
| <*> foo.tex
|            
| ? 
| ! Emergency stop.
| <inserted text> 
|                 \par 
| <*> foo.tex
|            
| !  ==> Fatal error occurred, no output PDF file produced!
| Transcript written on foo.log.
`----

I think that the the bottom buffer should display the end of the
*Shell Command Output* buffer (instead of *Async Shell Command*) after
invoking `M-n P'.

Cheers

Patrick

Footnotes: 
[1] I always switch back to the Rnw buffer anyway. Can I keep the
focus there by default?

-- 
Europa: Die Zehn Gebote haben 279 Wörter, die amerikanische
Unabhängigkeits- erklärung hat 300 Wörter. Die EU-Verordnung zur
Einfuhr von Karamelbonbons hat 25911 Wörter.
                                                 [Bodo H. Hauser]




More information about the ESS-help mailing list