ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Aditya Mahajan <adityam@umich.edu>
Subject: Re: buffers
Date: Mon, 31 Jul 2006 18:21:58 -0400 (EDT)	[thread overview]
Message-ID: <Pine.WNT.4.63.0607311812060.2520@nqvgln> (raw)
In-Reply-To: <9E95C6CD-7B1F-496A-AF19-6F5B6E6B50FE@science.uva.nl>

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

  reply	other threads:[~2006-07-31 22:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-31 20:52 buffers Hans van der Meer
2006-07-31 22:21 ` Aditya Mahajan [this message]
2006-08-01 10:50   ` buffers Hans van der Meer
2006-08-07 15:47   ` buffers Aditya Mahajan
2006-08-08  9:44     ` buffers 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=Pine.WNT.4.63.0607311812060.2520@nqvgln \
    --to=adityam@umich.edu \
    --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).