From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/13647 Path: main.gmane.org!not-for-mail From: Simon Pepping Newsgroups: gmane.comp.tex.context Subject: Re: pushmacro Date: Tue, 30 Sep 2003 21:06:48 +0200 Sender: ntg-context-admin@ntg.nl Message-ID: <20030930190648.GA19569@scaprea> References: <5.2.0.9.1.20030927121550.01b54f30@server-1> <000f01c38364$947c05b0$0500a8c0@best> <20030925191353.GB603@scaprea> <5.2.0.9.1.20030927121550.01b54f30@server-1> <5.2.0.9.1.20030930100004.02851350@server-1> Reply-To: ntg-context@ntg.nl NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1064949266 784 80.91.224.253 (30 Sep 2003 19:14:26 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 30 Sep 2003 19:14:26 +0000 (UTC) Original-X-From: ntg-context-admin@ntg.nl Tue Sep 30 21:14:24 2003 Return-path: Original-Received: from ref.vet.uu.nl ([131.211.172.13] helo=ref.ntg.nl) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1A4Px2-0003N3-00 for ; Tue, 30 Sep 2003 21:14:24 +0200 Original-Received: from ref.ntg.nl (localhost.localdomain [127.0.0.1]) by ref.ntg.nl (Postfix) with ESMTP id 71C5610B28; Tue, 30 Sep 2003 21:14:22 +0200 (MEST) Original-Received: from hgatenl.hobby.nl (ns.hobby.nl [212.72.224.8]) by ref.ntg.nl (Postfix) with ESMTP id 2BBD010AE7 for ; Tue, 30 Sep 2003 21:07:11 +0200 (MEST) Original-Received: from hgatenl.hobby.nl (localhost [127.0.0.1]) by hgatenl.hobby.nl (8.12.9/8.12.9) with ESMTP id h8UJ75Po054246 for ; Tue, 30 Sep 2003 21:07:05 +0200 (CEST) (envelope-from spepping@scaprea.hobby.nl) Original-Received: (from uucp@localhost) by hgatenl.hobby.nl (8.12.9/8.12.9/Submit) with UUCP id h8UJ75sW054245 for ntg-context@ntg.nl; Tue, 30 Sep 2003 21:07:05 +0200 (CEST) Original-Received: from simon by scaprea.salix.nl with local (Exim 3.35 #1 (Debian)) id 1A4Pph-0006FP-00; Tue, 30 Sep 2003 21:06:49 +0200 Original-To: ntg-context@ntg.nl Mail-Followup-To: ntg-context@ntg.nl Content-Disposition: inline In-Reply-To: <5.2.0.9.1.20030930100004.02851350@server-1> User-Agent: Mutt/1.3.28i X-Virus-Scanned: by amavisd-new Errors-To: ntg-context-admin@ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.0.13 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.comp.tex.context:13647 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:13647 On Tue, Sep 30, 2003 at 10:04:11AM +0200, Hans Hagen wrote: > At 20:30 29/09/2003 +0200, you wrote: > >I use it in the same way as let, but for XML environments. For > >example, > > > >store the current value > >\letXMLenvironment{origindexterm}{indexterm}% > >redefine XML environment indexterm, > >do some work, > >restore the old value > >\letXMLenvironment{indexterm}{origindexterm}} > > in that case: > > \expandafter\pushmacro\csname...\endcsname > \expandafter\popmacro\csname ...\endcsname > > is nicer since it works nested as well > > wo maybe we should have: \pushXMLmeaning \popXMLmeaning > > \def\pushXMLmeaning#1% > {\@EA\pushmacro\csname\@@XMLelement:#1/\endcsname > \@EA\pushmacro\csname\@@XMLelement:#1\endcsname > \@EA\pushmacro\csname\@@XMLelement:/#1\endcsname} > > \def\popXMLmeaning#1% > {\@EA\popmacro\csname\@@XMLelement:#1/\endcsname > \@EA\popmacro\csname\@@XMLelement:#1\endcsname > \@EA\popmacro\csname\@@XMLelement:/#1\endcsname} > > Does that suit your needs? I have never used \pushmacro, but if I see it right, it pushes the macro on a stack for later restore. That would suit the example I have given. But it would not always satisfy me. For example, when I want to use a predefined value as the new value: store the current value \pushXMLmeaning{indexterm}% redefine XML environment indexterm, e.g. as \letXMLenvironment{indexterm}{specialindexterm} do some work, restore the old value \popXMLmeaning{indexterm} Regards, Simon -- Simon Pepping email: spepping@scaprea.hobby.nl home page: http://scaprea.hobby.nl