Here is a simpler test case:
\documentclass{article} \begin{document} \emph{ \end{document}
The problem seems to be that TeX-next-error expects every error in the log file to have a line number attached to it. But the error here is
! File ended while scanning use of \emph .
which doesn't generate a line number.
Here is a simpler test case:
\documentclass{ article}
\begin{document}
\emph{
\end{document}
The problem seems to be that TeX-next-error expects every error in the log file to have a line number attached to it. But the error here is
! File ended while scanning use of \emph .
which doesn't generate a line number.