\output or \every*), but know
that other macros use the token register, too. (A common requirement
is to work on \everypar, but LaTeX changes \everypar at
every touch and turn.)
The following technique, due to David Kastrup, does what you need, and
allows an independent package to play the exact same game:
\let\mypkg@@everypar\everypar
\newtoks\mypkg@everypar
\mypkg@everypar\expandafter{\the\everypar}
\mypkg@@everypar{\mypkgs@ownstuff\the\mypkg@everypar}
\def\mypkgs@ownstuff{%
<stuff to do at the start of the token register>%
}
\let\everypar\mypkg@everypar
As you can see, the package (mypkg)
\everypar
(which is frozen into any surrounding environment, which will carry
on using the original);
\everypar and
initialises it with the current contents of \everypar;
\everypar to execute its own extra code,
as well as the contents of its own token register;
\everypar at the new token register.
\mypkg@... is (sort of) blessed for LaTeX package
internal names, which is why this example uses macros of that form.
This question on the Web: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=subverttoks