Sat, 13 Sep 2008 22:30:11 +0100
I wonder if anyone can make a suggestion on how to solve a problem I'm
finding rather tricky with my "keys" efforts. The issue is adding code
to an existing macro. There are a number of scenarios, but I control
the initial definition, and so I have three possibilities:
1) Definitions with a known argument pattern (one parameter #1). Here,
I can "recover" the code out of the macro definition, add to in and
re-cast the macro. This works for \def:Npn and \def:Npx
2) \def:Npn macros with unknown "p". Here, I can save the argument
pattern to a toks, and the body to a second toks. The macro can then be
redefined using the information in the two toks as needed.
3) \def:Npx macros with unknown "p". This is the problem. I can of
course save the argument and body *as given*, but can't find a method to
get the body toks expanded, nor a reliable way of recovering the data
from the macro definition itself.
Any ideas for (3) would be welcome. One extra point is that ideally I
don't want to using \meaning + \scantokens, etc., as this looses catcode
information. I'm hoping for a trick at the initial point of definition
based on the fact that I can hold onto the various bits and pieces.