Why isn't diagrams.sty compatible with LuaTeX
The version from
http://www.paultaylor.eu/diagrams/diagrams.sty
works without any error with lualatex on your example.
That version is now
\ProvidesPackage{diagrams}[2014/12/31 v3.94 Paul Taylor's commutative diagrams]
and produces the same output in luatex and pdftex.
Older answer below.
\ProvidesPackage{diagrams}[2011/04/19 v3.94 Paul Taylor's commutative diagrams]%%
pdflatex
lualatex
The observant will notice that these are not identical. Might be worth raising on the luatex list.
The luatex code seems to get a double box at the start of a pararaph which means that after \setbox\z@\lastbox
doesn't clear the horizontal list and you get an extra blank para generated:
pdflatex
\CD@r ->\CD@GB \lastpenalty \unpenalty \ifnum \CD@GB >\z@ \setbox \z@ \lastbox
\CD@lB
{\count102}
{\unpenalty}
{\ifnum}
{false}
{\par}
{internal vertical mode: \unskip}
luatex
\CD@r ->\CD@GB \lastpenalty \unpenalty \ifnum \CD@GB >\z@ \setbox \z@ \lastbox
\CD@lB
{\count102}
{\unpenalty}
{\ifnum}
{false}
{\par}
@firstpass
[][]
@\par via @0 b=0 p=-10000 d=81000000
@@1: line 1.2- t=81000000 -> @0
{internal vertical mode: \unskip}
If you wish to discuss this or other issues arising from my TeX code, please email me directly because I do not read TeX websites and am not willing to conduct discussions in public.
Thanks to Sean for his welcome, but without meaning to be patronising I did my TeX stuff before he was born and I don't want to join any new TeX "communities", even less to gain "reputation" (I have more than enough of that game on MathOverFlow). As you can see from elsewhere on this page, TeX just caused me grief. Probably many of the other early adopters have similar stories. I maintained an off-the-shelf TeX system for Imperial College before texlive or any Linux package management systems existed and I was abused by the College management for doing so, eventually losing my job.
It would appear that there is a bug in LuaTeX (or a difference from Knuth's TeX) in that \par appears to generate an extra \baselineskip and \whatsit.
If someone intimately familiar with LuaTeX would like to contact me directly I can try to explain what I do with paragraphs within the diagrams package so that they can track this bug down.
For anyone who simply wants to use my package under LuaTeX the quick fix is this: after \usepackage{diagrams} add
% take this out when you update the diagrams package
\makeatletter
\let\oldCD@t\CD@t
\def\CD@t{\oldCD@t\baselineskip0pt\relax}
\makeatother
Please tell me privately whether this is successful.