ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
Subject: Re: About \defineshortcut
Date: Tue, 20 Dec 2005 23:28:41 +0100	[thread overview]
Message-ID: <43A88599.9020800@wxs.nl> (raw)
In-Reply-To: <43A879A9.7080109@mail.ru>

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 <b:oeps> or <e:oeps>

\startwhatever
oeps <b:oeps> or <e:oeps>
\stopwhatever

oeps <b:oeps> or <e:oeps>

\input tufte

\stoptext

Hans

  reply	other threads:[~2005-12-20 22:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-15 21:31 Radhelorn
2005-12-16 19:18 ` Taco Hoekwater
2005-12-17 12:38   ` Radhelorn
2005-12-17 13:49     ` Taco Hoekwater
2005-12-20 21:37   ` Radhelorn
2005-12-20 22:28     ` Hans Hagen [this message]
2005-12-21  7:53       ` Radhelorn
2005-12-21  9:06         ` Hans Hagen

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=43A88599.9020800@wxs.nl \
    --to=pragma@wxs.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).