Using the following:
\margindata{some macro expansions}
I know that \margindata is typeset at a later moment than its place in the code suggests. The problem is that macro expansions inside the {}'s are expanded twice. This interferes badly with the things I want to happen.
Tracing what happens, I conclude that the result of the first expansion is lost and is not carried into the actual placement of the marginnote.
The question this is: how to solve this problem?