# Relative positioning of Lewis electrons in chemfig

I am defining a submolecule in chemfig (2,2'-bipyridine) and I want to show the lone pair of electrons on both the Nitrogens. (For those who care, I wish to show a coordination bond between the lone pairs and a metal but that's the next question!)

I have defined the submolecule and when I display it rotated the positioning of the lone pairs does not rotate as the \lewis command uses absolute positions rather than relative positions.

Is it possible to have relative lewis positions which can allow for rotation of the full molecule? (I attach nodes to the Ns so I can draw dative bonds from them at a later stage...)

MWE below...

\documentclass{article}
\usepackage{chemfig}

\definesubmol{bipy}{*6(-=-(-*6(-=-=-@{datN1}\lewis{3:,N}=))=@{datN2}\lewis{2:,N}-=)}

\begin{document}

\chemfig{!{bipy}}

\vspace{1cm}%just for clarity
\chemfig{[:60]!{bipy}}\\
Should have the lone pair of electrons on the lower N in position 4 and on the upper N in position 5 according to   \verb|\lewis{}| command in chemfig
\end{document}


-

Here is an imperfect idea. The current angle of the arriving bond at an atom is available through \CF@current@angle. The proposal below uses it to compute the position of the lone pair.

\documentclass{article}
\usepackage{chemfig}

% this is far from perfect, the most obvious restriction is that it only allows
% to place _one_ electron pair.
\makeatletter
\def\rellewis@stripdecimals#1.#2\q@stop{#1}
\def\rellewis#1{\rel@lewis#1\q@stop}
\def\rel@lewis#1#2,#3\q@stop{%
\pgfmathparse{mod(#1+round(\CF@current@angle/45),8)}%
\edef\rellewis@pos{\expandafter\rellewis@stripdecimals\pgfmathresult\q@stop}%
\expandafter\lewis\expandafter{\rellewis@pos#2,#3}%
}
\makeatother

\definesubmol{bipy}{*6(-=-(-*6(-=-=-\rellewis{6:,N}=))=\rellewis{7:,N}-=)}

\begin{document}

\chemfig{!{bipy}}