\documentclass{article}
\usepackage{expl3}
\usepackage{everypage}
\ExplSyntaxOn
\AddEverypageHook { \sean_test: }
\msg_new:nnnn { test } { message }
{ this ~ is ~ a ~ rubbish ~ message }
{ it's ~ a ~ minimal ~ example }
\cs_new_protected:Npn \sean_test:
{
\typeout{++before++}
\msg_fatal:nn { test } { message }
\typeout{++after++}
}
\ExplSyntaxOff
\usepackage{mwe}
\begin{document}
\lipsum[1-1000]
\end{document}
I'm rather surprised I was able to make a minimal example of this, but the above will produce (many copies of)
++after++
[26]
++before++
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! Fatal test error: "message"
!
! this is a rubbish message
!
! See the test documentation for further information.
!
! For immediate help type H <return>.
!...............................................
l.23 \lipsum[1-1000]
! You can't use `\end' in internal vertical mode.
\__msg_fatal_code:nnnnnn ...l_text_tl }\tex_end:D
l.23 \lipsum[1-1000]
++after++
[27]
++before++
What's with this business?
! You can't use `\end' in internal vertical mode.
\__msg_fatal_code:nnnnnn ...l_text_tl }\tex_end:D
I tried introducing both \leavevmode\tex_end:D and \clearpage\tex_end:D to no effect.
expl3and2eprogramming? shameful :) Come to the dark side :) – Sean Allred Dec 10 '14 at 16:16\defand\aftergroup2e programming:-) (I have my name on some of the l3 code, surely I'm not supposed to use it as well:-) – David Carlisle Dec 10 '14 at 16:22