On Mon, 31 Jul 2006, Hans van der Meer wrote:

> The ConTeXt manual tells me on page 237:
>
>       You can define your own buffer with:
>       \definebuffer[...]
>       ... name
>       After this command /getbuffer and \typebuffer are available where 
> buffer is the name of the buffer.
>
> I do:
>       \definebuffer[left]
>       \startbuffer[left]
>       left\crlf
>       \stopbuffer
>       \typeleft
> and it gives me the error:
>       ! Undefined control sequence.
> \typeleft ->\dodotypebuffer
>                           [left][def-3]
> l.92 \typeleft
>
> then I try:
>       \typebuffer[left]
>
> this gives a typeset message [file examdoc-def-2.tmp does not exist]
> (file examdoc.tex being the containing tex file)
>
> when I try
>       \getbuffer[left] or \getleft
> nothing at all seems to happen?
>
> Why doesn't it work according to the manual?
> Or do I misunderstand the manual completely?

If you just want to "tag" buffers, you do not need to define new ones. 
You can simply do

\startbuffer[test]
Hello world
\stopbuffer

\typebuffer[test]

\getbuffer[test]


Defining new buffers is useful if you do not want to call buffers by 
some other name. This does not allow you to "tag" the buffers. There 
is also a bug in core-buf.tex due to which \type<buffer> did not work.

\unprotect
\def\dodefinebuffer[#1][#2]%
   {\iffirstargument % else problems
      \doglobal\increment\nofdefinedbuffers
      \letvalue{\??bu#1\c!number}\nofdefinedbuffers
      \letvalue{\??bu#1\c!paragraph}\v!no
      \setevalue{\e!start#1}%

{\noexpand\dostartbuffer[#1][def-\nofdefinedbuffers][\e!start#1][\e!stop#1]}%
      \setevalue{\e!get#1}%
        {\noexpand\dodoprocessTEXbuffer[#1][def-\nofdefinedbuffers]}%
      \setevalue{\e!type#1}%
        {\noexpand\dotypebuffer[#1][def-\nofdefinedbuffers]}%
        % was {\noexpand\dodotypebuffer[#1][def-\nofdefinedbuffers]}%
      \getparameters[\??bu#1][#2]%
    \fi}
\protect


\definebuffer[Example]

\startExample
   Hello again
\stopExample

\typeExample %The above fix is needed for this.

\getExample


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

Reply via email to