<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">David Carlisle wrote:<br>
<br>
</div>
<blockquote type="cite" cite="mid:CAEW6iOgSNCe=eaBk-y_c4xdZziTDh6X0TemwBJ_+BGjvjMDzvQ@mail.gmail.com">
<div dir="ltr">
<div>basically Phil you are doomed (unless you are tempted to try luatex which has more possibilities)</div>
<div>you mention paragraphs ending with \par, \endgraf, a blank line or \vskip.</div>
<div>blank lines and vskip are Ok really as they cause the \par token to be inserted, so if you have hooked some code into \par that will run.</div>
<div>\endgraf or other commands let to the primitive are Ok if you give yourself access to the format early enough that you know that no one has taken  control.</div>
<div>But there are two cases that you really can't easily  trap.</div>
<div>In classic tex you can end a paragraph by ending a vbox, that does not insert a \par token: it just directly ends the paragraph with no macro-layer hook at all.</div>
<div>In pdftex (and xetex) a paragraph can be ended with \primitive\par which is again pretty tricky to catch without breaking other uses of \primitive.</div>
<div>partial paragraphs ended with $$ also make things interesting.<br>
</div>
</div>
</blockquote>
<br>
Many thanks for your comments/analysis, David — much appreciated.  It would seem that you and I have reached the same (sad) conclusions, but you remind me that I have another obscure query — how (if at all) can I achieve the
<i>intended </i>effect of :<br>
<br>
<blockquote type="cite">\def \par {\relax}
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
        margin-right:0px; -qt-block-indent:0; text-indent:0px;">
\def \tmp {\let \foo = }</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
        margin-right:0px; -qt-block-indent:0; text-indent:0px;">
\expandafter \tmp \primitive \par</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
        margin-right:0px; -qt-block-indent:0; text-indent:0px;">
\message {\meaning \foo}</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
        margin-right:0px; -qt-block-indent:0; text-indent:0px;">
\end</p>
</blockquote>
<br>
That is, how can I \let a control sequence to a TeX primitive if that primitive has already been clobbered (e.g., overwritten by a macro) ?<br>
** Phil.<br>
<br>
</body>
</html>