Received: from mail.proteosys.com ([213.139.130.197]) by nummer-3.proteosys with Microsoft SMTPSVC(6.0.3790.3959); Thu, 11 Sep 2008 00:38:09 +0200 Received: by mail.proteosys.com (8.13.8/8.13.8) with ESMTP id m8AMc4NE023278 for ; Thu, 11 Sep 2008 00:38:04 +0200 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [129.206.100.94]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id m8AMXoTx009592 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 11 Sep 2008 00:33:50 +0200 Received: from listserv.uni-heidelberg.de (localhost.localdomain [127.0.0.1]) by listserv.uni-heidelberg.de (8.13.1/8.13.1) with ESMTP id m8AM1F3O017495; Thu, 11 Sep 2008 00:33:43 +0200 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 15.5) with spool id 28678 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Thu, 11 Sep 2008 00:33:43 +0200 Received: from relay.uni-heidelberg.de (relay.uni-heidelberg.de [129.206.100.212]) by listserv.uni-heidelberg.de (8.13.1/8.13.1) with ESMTP id m8AMXgnX020631 for ; Thu, 11 Sep 2008 00:33:43 +0200 Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.177]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id m8AMXd4H009415 for ; Thu, 11 Sep 2008 00:33:42 +0200 Received: from morse.mittelbach-online.de (p4FD4416E.dip.t-dialin.net [79.212.65.110]) by mrelayeu.kundenserver.de (node=mrelayeu3) with ESMTP (Nemesis) id 0MKxQS-1KdYFm3YC9-0000Px; Thu, 11 Sep 2008 00:33:39 +0200 Received: by morse.mittelbach-online.de (Postfix, from userid 501) id 16832653E6; Thu, 11 Sep 2008 00:33:36 +0200 (CEST) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit References: <48C57767.9030602@morningstar2.co.uk> <18632.13756.225135.207821@morse.mittelbach-online.de> <48C83E32.2080608@morningstar2.co.uk> X-Mailer: VM 7.19 under Emacs 21.3.1 X-Provags-ID: V01U2FsdGVkX19EU/dsGqJR7BR7aDaXC3YS8Ek/0x2nFEhiEh/ XiIaZEOXiegp9caJv001UUqw75XGPEUieSC+hpkfDe/h/bQNTZ +Krvm7HU3gxeAEeg2T24dWqNymnt+oc X-Spam-Whitelist-Provider: Message-ID: <18632.19263.975505.767009@morse.mittelbach-online.de> Date: Thu, 11 Sep 2008 00:33:35 +0200 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Frank Mittelbach Subject: Re: Something like \patchcmd To: LATEX-L@LISTSERV.UNI-HEIDELBERG.DE In-Reply-To: <48C83E32.2080608@morningstar2.co.uk> Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: X-ProteoSys-SPAM-Score: -102.464 () BAYES_00,FORGED_RCVD_HELO,USER_IN_WHITELIST X-Scanned-By: MIMEDefang 2.64 on 213.139.130.197 Return-Path: owner-latex-l@LISTSERV.UNI-HEIDELBERG.DE X-OriginalArrivalTime: 10 Sep 2008 22:38:10.0024 (UTC) FILETIME=[E6D05E80:01C91395] Status: R X-Status: X-Keywords: X-UID: 5285 Joseph, > 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. ok some sort of obvious :-) like for me, but you'll agree that \thanks is not a tlp as it expects an argument (ie it therefore a function) > 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! well the \tlp_put functions work because in 2e \g@addto@macro only works for macros without arguments (ie "tlp"s in expl3 terminology) try \show\thanks \g@addto@macro\thanks{foo} \show\thanks > I'm guessing that something like \g@addto@macro will be needed, in the end. so \tlp_gput_right:Nn is indeed the replacement for \g@addto@macro (which would have been better named \g@addto@macro@not@having@arguments) > > 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. and even if, I agree that for certain types of questions (packages on top of packages) such a patching functionality would be useful. and providing \patchcmd shouldn't be too difficult good night frank