ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Using \dorecheckindentation inside a group
@ 2018-08-10 17:41 Aditya Mahajan
  2018-08-10 18:00 ` Wolfgang Schuster
  0 siblings, 1 reply; 3+ messages in thread
From: Aditya Mahajan @ 2018-08-10 17:41 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi,

In t-filter module, I use a group inside \startfilter ... \stopfilter to 
keep various definitions local. However, as reported on [1], this breaks 
the `indentnext` option. The following minimal example illustrates the 
issue:

\unprotect
\definenamespace
   [whatever]
   [
     name=whatever,
     command=yes,
     setup=list,
     parent=whatever,
   ]

\appendtoks
     \setuevalue{\e!start\currentwhatever}{\start_whatever[\currentwhatever]}%
     \setuvalue {\e!stop\currentwhatever}{\stop_whatever}%
\to \everydefinewhatever

\starttexdefinition start_whatever
     \dodoubleargument\start_whatever_indeed
\stoptexdefinition

\starttexdefinition start_whatever_indeed[#1][#2]
   \begingroup % to keep assignments local
   \edef\currentwhatever{#1}
   \setupwhatever[#1][#2]
\stoptexdefinition

\starttexdefinition stop_whatever
   \useindentnextparameter\whateverparameter
   \dorechecknextindentation
   \endgroup
\stoptexdefinition

\protect

\definewhatever[whatever]

\setupindenting[big,yes]

\startbuffer
\input ward

\startwhatever
   \input tufte
\stopwhatever

\input ward
\stopbuffer

\starttext

\section{With indentnext=yes}
\setupwhatever[indentnext=yes]
\getbuffer

\section{with indentnext=no}
\setupwhatever[indentnext=no]
\getbuffer

\section{with indentnext=auto}
\setupwhatever[indentnext=auto]
\getbuffer

\stoptext

I use a \begingroup inside \start_whatever to keep the definitions local 
(otherwise \setupwhatever[#1][#2] will change the global setup). This 
means that I have to use \dorecheckindentation \endgroup. As a result, 
when I use `indentnext=auto`, the check for \par fails (see the third case 
in the above example).

How can I fix this?

Thanks,
Aditya

[1]: 
https://tex.stackexchange.com/questions/445198/context-break-paragraph-after-t-vim-code-block
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Using \dorecheckindentation inside a group
  2018-08-10 17:41 Using \dorecheckindentation inside a group Aditya Mahajan
@ 2018-08-10 18:00 ` Wolfgang Schuster
  2018-08-10 19:49   ` Aditya Mahajan
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfgang Schuster @ 2018-08-10 18:00 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Aditya Mahajan



Aditya Mahajan schrieb am 10.08.18 um 19:41:
> Hi,
>
> In t-filter module, I use a group inside \startfilter ... \stopfilter 
> to keep various definitions local. However, as reported on [1], this 
> breaks the `indentnext` option. The following minimal example 
> illustrates the issue:
>
> \unprotect
> \definenamespace
>   [whatever]
>   [
>     name=whatever,
>     command=yes,
>     setup=list,
>     parent=whatever,
>   ]
>
> \appendtoks
> \setuevalue{\e!start\currentwhatever}{\start_whatever[\currentwhatever]}%
>     \setuvalue {\e!stop\currentwhatever}{\stop_whatever}%
> \to \everydefinewhatever
>
> \starttexdefinition start_whatever
>     \dodoubleargument\start_whatever_indeed
> \stoptexdefinition
>
> \starttexdefinition start_whatever_indeed[#1][#2]
>   \begingroup % to keep assignments local
>   \edef\currentwhatever{#1}
>   \setupwhatever[#1][#2]
> \stoptexdefinition
>
> \starttexdefinition stop_whatever
>   \useindentnextparameter\whateverparameter
>   \dorechecknextindentation
>   \endgroup
> \stoptexdefinition

Move \dorechecknextindentation after \endgroup.

\starttexdefinition stop_whatever
   \useindentnextparameter\whateverparameter
   \endgroup
   \dorechecknextindentation
\stoptexdefinition

Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Using \dorecheckindentation inside a group
  2018-08-10 18:00 ` Wolfgang Schuster
@ 2018-08-10 19:49   ` Aditya Mahajan
  0 siblings, 0 replies; 3+ messages in thread
From: Aditya Mahajan @ 2018-08-10 19:49 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Fri, 10 Aug 2018, Wolfgang Schuster wrote:

> Aditya Mahajan schrieb am 10.08.18 um 19:41:
>> Hi,
>> 
>> In t-filter module, I use a group inside \startfilter ... \stopfilter to 
>> keep various definitions local. However, as reported on [1], this breaks 
>> the `indentnext` option. The following minimal example illustrates the 
>> issue:
>> 
>> \unprotect
>> \definenamespace
>>   [whatever]
>>   [
>>     name=whatever,
>>     command=yes,
>>     setup=list,
>>     parent=whatever,
>>   ]
>> 
>> \appendtoks
>> \setuevalue{\e!start\currentwhatever}{\start_whatever[\currentwhatever]}%
>>     \setuvalue {\e!stop\currentwhatever}{\stop_whatever}%
>> \to \everydefinewhatever
>> 
>> \starttexdefinition start_whatever
>>     \dodoubleargument\start_whatever_indeed
>> \stoptexdefinition
>> 
>> \starttexdefinition start_whatever_indeed[#1][#2]
>>   \begingroup % to keep assignments local
>>   \edef\currentwhatever{#1}
>>   \setupwhatever[#1][#2]
>> \stoptexdefinition
>> 
>> \starttexdefinition stop_whatever
>>   \useindentnextparameter\whateverparameter
>>   \dorechecknextindentation
>>   \endgroup
>> \stoptexdefinition
>
> Move \dorechecknextindentation after \endgroup.
>
> \starttexdefinition stop_whatever
>  \useindentnextparameter\whateverparameter
>  \endgroup
>  \dorechecknextindentation
> \stoptexdefinition

Thanks! I didn't realize that \useindentnextparameter was "global".

Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-08-10 19:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-10 17:41 Using \dorecheckindentation inside a group Aditya Mahajan
2018-08-10 18:00 ` Wolfgang Schuster
2018-08-10 19:49   ` Aditya Mahajan

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).