ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* First letter lost possible cause: \grabbfferdata
@ 2014-06-25 19:51 Rik Kabel
  2014-06-25 20:03 ` Rik Kabel
  0 siblings, 1 reply; 4+ messages in thread
From: Rik Kabel @ 2014-06-25 19:51 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 2293 bytes --]

Recently there have been reports of the first letter of a line of text 
being lost in the database and letter modules.

I tracked down what appears to be the same problem and developed a 
work-around.

The problem appears to be with the \grabbufferdata command. Something 
has changed in the way it works, and it now swallows the first token of 
the buffer that it grabs. It may also show up with other commands, but 
this is the only one I have found in my projects.

If you have code with this command, a workaround is to insert 
\ignorespaces after it. I have no idea why this helps. If you do not 
have the code (if it is in somebody else's module), then using a blank 
line or dummy argument or \relax after the command that calls the code 
with \grabbufferdata may help.

The following code shows the issues and these workarounds.

    % macros=mkvi

    \starttexdefinition unexpanded startNoIgnore
       \begingroup
       \dostartNoIgnore
    \stoptexdefinition
    \starttexdefinition dostartNoIgnore
       \grabbufferdata[Test][startNoIgnore][stopTest]
    \stoptexdefinition

    \starttexdefinition unexpanded startWithIgnore
       \begingroup
       \dostartWithIgnore
    \stoptexdefinition
    \starttexdefinition dostartWithIgnore
       \grabbufferdata[Test][startWithIgnore][stopTest]
       \ignorespaces
    \stoptexdefinition

    \starttexdefinition stopTest
       \getbufferdata[Test]
       \endgroup
    \stoptexdefinition

    \define\TestText
      {\qquad If you can read this the first token was not swallowed.}

    \starttext

    \subject{Test without \tex{ignorespaces}}

    First, the problem:

    \startNoIgnore\TestText\stopTest

    And the same with \type{{}}

    \startWithIgnore{}\TestText\stopTest

    Workaround with \tex{relax}

    \startNoIgnore\relax\TestText\stopTest

    Workaround with blank line

    \startNoIgnore

    \TestText\stopTest

    \subject{Test with \tex{ignorespaces}}

    This now works:

    \startWithIgnore\TestText\stopTest

    And the same with \type{{}}

    \startWithIgnore{}\TestText\stopTest

    And the same with \tex{relax}

    \startWithIgnore\relax\TestText\stopTest

    And the same with a blank line after the opening

    \startWithIgnore

    \TestText\stopTest
    \stoptext




-- 
Rik Kabel

[-- Attachment #1.2: Type: text/html, Size: 3366 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: First letter lost possible cause: \grabbfferdata
  2014-06-25 19:51 First letter lost possible cause: \grabbfferdata Rik Kabel
@ 2014-06-25 20:03 ` Rik Kabel
  2014-06-25 20:07   ` Hans Hagen
  0 siblings, 1 reply; 4+ messages in thread
From: Rik Kabel @ 2014-06-25 20:03 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 627 bytes --]

On 2014-06-25 15:51, Rik Kabel wrote:
> Recently there have been reports of the first letter of a line of text 
> being lost in the database and letter modules.
>
> I tracked down what appears to be the same problem and developed a 
> work-around.
>
> The problem appears to be with the \grabbufferdata command. Something 
> has changed in the way it works, and it now swallows the first token 
> of the buffer that it grabs. It may also show up with other commands, 
> but this is the only one I have found in my projects.
>
And as soon as I post, I see that Hans has found the problem in the 
buffering  code.

-- 
Rik Kabel

[-- Attachment #1.2: Type: text/html, Size: 1144 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: First letter lost possible cause: \grabbfferdata
  2014-06-25 20:03 ` Rik Kabel
@ 2014-06-25 20:07   ` Hans Hagen
  2014-06-25 21:05     ` Rik
  0 siblings, 1 reply; 4+ messages in thread
From: Hans Hagen @ 2014-06-25 20:07 UTC (permalink / raw)
  To: ntg-context

On 6/25/2014 10:03 PM, Rik Kabel wrote:
> On 2014-06-25 15:51, Rik Kabel wrote:
>> Recently there have been reports of the first letter of a line of text
>> being lost in the database and letter modules.
>>
>> I tracked down what appears to be the same problem and developed a
>> work-around.
>>
>> The problem appears to be with the \grabbufferdata command. Something
>> has changed in the way it works, and it now swallows the first token
>> of the buffer that it grabs. It may also show up with other commands,
>> but this is the only one I have found in my projects.
>>
> And as soon as I post, I see that Hans has found the problem in the
> buffering  code.

but you're going to test it -)


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: First letter lost possible cause: \grabbfferdata
  2014-06-25 20:07   ` Hans Hagen
@ 2014-06-25 21:05     ` Rik
  0 siblings, 0 replies; 4+ messages in thread
From: Rik @ 2014-06-25 21:05 UTC (permalink / raw)
  To: ntg-context

On 2014-06-25 16:07, Hans Hagen wrote:
> On 6/25/2014 10:03 PM, Rik Kabel wrote:
>> On 2014-06-25 15:51, Rik Kabel wrote:
>>> Recently there have been reports of the first letter of a line of text
>>> being lost in the database and letter modules.
>>>
>>> I tracked down what appears to be the same problem and developed a
>>> work-around.
>>>
>>> The problem appears to be with the \grabbufferdata command. Something
>>> has changed in the way it works, and it now swallows the first token
>>> of the buffer that it grabs. It may also show up with other commands,
>>> but this is the only one I have found in my projects.
>>>
>> And as soon as I post, I see that Hans has found the problem in the
>> buffering  code.
>
> but you're going to test it -)
Indeed I have, but my tests mean little beyond what I can eyeball to see 
if it still looks okay. I might say that the issue is resolved for my 
small environment but I do not know what side-effects may result from 
the change. I have no library of edge cases, no integrated build 
environment, and only a single platform.

That said, however, the issue disappears for my projects when I remake 
ConTeXt (and ConTeXtjit) with your patch.

And clearly, the \ignorespaces that I used in my workaround was just a 
convenient no-op. I could have used {} or \relax to the same effect.

-- 
Rik Kabel

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

end of thread, other threads:[~2014-06-25 21:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-25 19:51 First letter lost possible cause: \grabbfferdata Rik Kabel
2014-06-25 20:03 ` Rik Kabel
2014-06-25 20:07   ` Hans Hagen
2014-06-25 21:05     ` Rik

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