\documentclass{article}

\begin{document}
should be displayed
\verb|\end{document}|
should be displayed too.
\end{document} end of line discarded.

should not be displayed.
\end{document}
should not be displayed either.

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 
