groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Groff] Re: groff .cc page trap issue


From: Ian! D. Allen
Subject: [Groff] Re: groff .cc page trap issue
Date: Tue, 5 Aug 2003 12:33:58 -0400
User-agent: Mutt/1.4.1i

On Fri, Aug 01, 2003 at 11:58:51AM +0200, Werner LEMBERG wrote:
> Hmm, I could change the .de1 request (and friends) to reset both the
> escape and control characters to the default while executing the defined
> macro.  [...]  Consider de1 as a request where `everything is normal'
> -- similar to .char which also resets the escape character to `\'.

Okay, maybe this could be made to work.

As proposed, it has side-effects that aren't nice for users that want
to define a macro that changes the escape and/or primary or secondary
control characters.  Suppose I want to define a "start code" macro:

    .de1 StartCode
    .nf
    .in +3m
    .c2 %
    .cc @
    ..

The above definition wouldn't work if .de1 restored the escape and/or
control characters at the end of the macro.  If I used ".de" to define
the macro, the macro wouldn't work in a trap (where the control character
might not be a dot).

With your proposal it is still impossible to write a trap-called macro
that is guaranteed to set the control character:

 - If I define such a macro with ".de foo", it might not work when called
   in a trap (because the control character might already be redefined).

 - If I define such a macro with ".de1 foo", it can't redefine the
   control character (because you will reset it on exit from the macro).

Having a push-down stack of escape and control character environments
is useful in itself; but, I think the push/pop has to be controlled by
the user, not an automatic push/pop around a macro.

My proposed \. character doesn't have these problems; you can program a
trap macro that always works and sets the control character:

    .de foo
    \.cc @
    ..

If your .de1 proposal had more of the above semantics, perhaps it would work.
More thought is needed...
    
-- 
-IAN!  Ian! D. Allen   Ottawa, Ontario, Canada
       EMail: address@hidden   WWW: http://www.idallen.com/
       College professor via: http://teaching.idallen.com/
       Board Member, TeleCommunities CANADA  http://www.tc.ca/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]