ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Simon Pepping <spepping@scaprea.hobby.nl>
Subject: Re: pushmacro
Date: Tue, 30 Sep 2003 21:06:48 +0200	[thread overview]
Message-ID: <20030930190648.GA19569@scaprea> (raw)
In-Reply-To: <5.2.0.9.1.20030930100004.02851350@server-1>

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

      reply	other threads:[~2003-09-30 19:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-25 12:57 XML command synonyms Pawel Jackowski na Onet
2003-09-25 14:41 ` Willi Egger
2003-09-25 15:18   ` Willi Egger
2003-09-25 19:13 ` Simon Pepping
2003-09-27  5:41   ` Pawel Jackowski na Onet
2003-09-27 10:18     ` Hans Hagen
2003-09-27 22:28       ` Pawel Jackowski na Onet
2003-09-29 18:30       ` Simon Pepping
2003-09-30  8:04         ` Hans Hagen
2003-09-30 19:06           ` Simon Pepping [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030930190648.GA19569@scaprea \
    --to=spepping@scaprea.hobby.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).