[NTG-context] About \defineshortcut

2005-12-15 Thread Radhelorn

Hello All!

There is intresting macros in cont-new -- shortcuts. It works pretty 
well, but I have one question: how to undefine them back?


For example after command:

\defineshortcut [//] [] [style=\em]

I can get slash only by \textslash (which is expected) and it breaks 
things like:


\typefile {some/dir/file}

So how to revert to previous meaning of '/'? It is possible to do it 
only temporarily?


--
Radhelorn <[EMAIL PROTECTED]>
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] About \defineshortcut

2005-12-16 Thread Taco Hoekwater

Radhelorn wrote:

Hello All!

There is intresting macros in cont-new -- shortcuts. It works pretty 
well, but I have one question: how to undefine them back?


For example after command:

\defineshortcut [//] [] [style=\em]


I can get slash only by \textslash (which is expected) and it breaks 
things like:


\typefile {some/dir/file}

So how to revert to previous meaning of '/'? It is possible to do it 
only temporarily?


Explicit \start a /b/ c \stop style grouping is normally best, but
a shortcut is just an active character with a closing defimiter,
so this will work for you special case:

  \catcode`\/=\other
  \typefile {some/dir/file}
  \catcode`\/=\active


Cheers, taco


___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] About \defineshortcut

2005-12-17 Thread Radhelorn

Taco Hoekwater wrote:

Radhelorn wrote:


Hello All!

There is intresting macros in cont-new -- shortcuts. It works pretty 
well, but I have one question: how to undefine them back?


For example after command:

\defineshortcut [//] [] [style=\em]



I can get slash only by \textslash (which is expected) and it breaks 
things like:


\typefile {some/dir/file}

So how to revert to previous meaning of '/'? It is possible to do it 
only temporarily?



Explicit \start a /b/ c \stop style grouping is normally best, but
a shortcut is just an active character with a closing defimiter,
so this will work for you special case:

  \catcode`\/=\other
  \typefile {some/dir/file}
  \catcode`\/=\active




Thanks Taco. I was experimenting with \bgroup \egroup and thinking about 
some more explicit and visible. BTW where is these \start \stop defined?


--
Radhelorn <[EMAIL PROTECTED]>
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] About \defineshortcut

2005-12-17 Thread Taco Hoekwater

Radhelorn wrote:
Thanks Taco. I was experimenting with \bgroup \egroup and thinking about 
some more explicit and visible. BTW where is these \start \stop defined?


core-sys.tex, line 128-136:

  \def\complexstart[#1]{\bgroup\getvalue{\e!start#1}}
  \def\complexstop [#1]{\getvalue{\e!stop #1}\egroup}

  \let\simplestart\bgroup
  \let\simplestop \egroup

  \definecomplexorsimple\start
  \definecomplexorsimple\stop

Cheers,

Taco



___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] About \defineshortcut

2005-12-20 Thread Radhelorn

Taco Hoekwater wrote:

For example after command:

\defineshortcut [//] [] [style=\em]


I can get slash only by \textslash (which is expected) and it breaks 
things like:


\typefile {some/dir/file}

So how to revert to previous meaning of '/'? It is possible to do it 
only temporarily?


Explicit \start a /b/ c \stop style grouping is normally best, but
a shortcut is just an active character with a closing defimiter,
so this will work for you special case:

  \catcode`\/=\other
  \typefile {some/dir/file}
  \catcode`\/=\active



I've experimented with various macros to undefine/temporarily disable 
shortcuts and found that most convenient variant is to insert this 
catcode changing into \typefile command. Why not to do this for every 
command, that accepts path parameters? This slows process down too much?


But this is just an afterthought.

I think that \defineshortcut commands are most useful inside some 
environment (start/stop pair). So it is possible to have such 
environment that restores back all catcode changes (or other variable 
changes) made inside it (like local variables in some programming 
laguages)? This can have many other uses.


--
Radhelorn <[EMAIL PROTECTED]>
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] About \defineshortcut

2005-12-20 Thread Hans Hagen

Radhelorn wrote:


Taco Hoekwater wrote:


For example after command:

\defineshortcut [//] [] [style=\em]



I can get slash only by \textslash (which is expected) and it breaks 
things like:


\typefile {some/dir/file}

So how to revert to previous meaning of '/'? It is possible to do it 
only temporarily?



Explicit \start a /b/ c \stop style grouping is normally best, but
a shortcut is just an active character with a closing defimiter,
so this will work for you special case:

  \catcode`\/=\other
  \typefile {some/dir/file}
  \catcode`\/=\active



I've experimented with various macros to undefine/temporarily disable 
shortcuts and found that most convenient variant is to insert this 
catcode changing into \typefile command. Why not to do this for every 
command, that accepts path parameters? This slows process down too much?


But this is just an afterthought.

I think that \defineshortcut commands are most useful inside some 
environment (start/stop pair). So it is possible to have such 
environment that restores back all catcode changes (or other variable 
changes) made inside it (like local variables in some programming 
laguages)? This can have many other uses.



i have no idea why you use shortcuts (i implemented it as a gimmick -)

grouping is doable with:

\starttext

\startsetups whatever
   \defineshortcut [b] [style=bold]
   \defineshortcut [e] [style=slanted]
\stopsetups

\definestartstop[whatever][commands=\setups{whatever}]

\input tufte

oeps  or 

\startwhatever
oeps  or 
\stopwhatever

oeps  or 

\input tufte

\stoptext

Hans
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] About \defineshortcut

2005-12-20 Thread Radhelorn

Hans Hagen wrote:

Radhelorn wrote:
I think that \defineshortcut commands are most useful inside some 
environment (start/stop pair). So it is possible to have such 
environment that restores back all catcode changes (or other variable 
changes) made inside it (like local variables in some programming 
laguages)? This can have many other uses.



i have no idea why you use shortcuts (i implemented it as a gimmick -)


Well I was reading sources and stumbled over these commands. I am using 
shortcuts to typeset programming examples in non standard languages and 
pseudo-code.




grouping is doable with:

\starttext

\startsetups whatever
   \defineshortcut [b] [style=bold]
   \defineshortcut [e] [style=slanted]
\stopsetups

\definestartstop[whatever][commands=\setups{whatever}]

\input tufte

oeps  or 

\startwhatever
oeps  or 
\stopwhatever

oeps  or 

\input tufte

\stoptext



Many thanks! I've looked this indeed!

It is a pity that such useful command (setups) remains undocumented. As 
far as I understand inside setups can be any commands and environment 
changes are fully restored after their execution. Right? And \setups 
command can replace any single command (in arguments and such).


If this is OK, then I will try to collect some more examples and post 
them on the WIKI later this week.


--
Radhelorn <[EMAIL PROTECTED]>
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] About \defineshortcut

2005-12-21 Thread Hans Hagen

Radhelorn wrote:

It is a pity that such useful command (setups) remains undocumented. 
As far as I understand inside setups can be any commands and 
environment changes are fully restored after their execution. Right? 
And \setups command can replace any single command (in arguments and 
such).


catcode changes are always tricky; if you make a style that uses them 
you also need to make sure that they will not clash with other changes 
(e.g. in the otr); nowadays, an active < is not that much of a problem 
since this is what the xml parser does anyway and context knows how to 
deal with that




If this is OK, then I will try to collect some more examples and post 
them on the WIKI later this week.



ok, or maybe a myway document ...

Hans

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context