Frank Mittelbach wrote:
> Joseph,
>
>  > I've been trying to work out if the current expl3 has anything like
>  > \patchcmd from etoolbox.
>
> the current expl3 doesn't have something comparible to \patchcmd, not on that
> level of complexity / generality
>
>
>  > Will suggested looking at the various \tlp_
>  > ... macros.  However, even a simple two-part test in this way fails:
>  >
>  > \documentclass{article}
>  > \usepackage{expl3}
>  > \CodeStart
>  > \cs_if_really_exist:cT{thanks}{
>  >   \tlp_if_in:NnT\thanks{\footnotemark}{
>  >     % Do something
>  >   }
>  >   \tlp_if_in:NnT\thanks{\footnotetext}{
>  >     % Also do something
>  >   }
>  > }
>  > \CodeStop
>  > \begin{document}
>  > \end{document}
>  >
>  > I guess I'm abusing the functions.  So have I missed something obvious?
>
> well, one thing obvious is \thanks is not a "tlp" variable is it?

No.  The original context of the suggestion was that I couldn't see a
replacement for \g@addto@macro (I may of course have missed it).  Here,
using one of the \tlp_put functions does work.  So I was extrapolating!
I'm guessing that something like \g@addto@macro will be needed, in the end.

> The \patchcmd does detokenization (loosing catcodes) and then
rebuilds the
> code using "current" catcodes, so it is kind of dangerous in situations

At least in the context I was thinking of, this would not be an issue.
I'd imagine that stuff with funny catcodes wouldn't typically be where a
simple find-and-replace would apply.

I'll stick with redefining \thanks for the moment, then.
--
Joseph Wright