On 15/09/2008, at 3:42 PM, Joseph Wright wrote:

> So my attempts to create a simple hook:
>
> \def:cpx {<key>} <arg spec.> {\exp_not:N\prehook <code>  
> \exp_not:posthook}
>
> fail when the added code contains #1, #2, ... My current approach at
> least does not give a TeX error under these circumstances (I've  
> added a
> custom one to warn of a problem).
>
> I'm sure I'm mossing something, but my knowledge of TeX's approach to
> doubling # characters, etc., is clearly insufficient to find it.

Maybe as a pre-cursor to this work we should port patchcmd to expl3?  
Even that package only handles "plain" argument specs, though.

W