On 7-11-2011 09:46, Wolfgang Schuster wrote:
Hi Hans,
there is a extra space at the end of the buffer content.
\def\starttest {\dowithbuffer{testbuffer}{starttest}{stoptest}\relax\processtest}
\def\processtest{“\ctxcommand{getbuffer("testbuffer")}”} %\def\processtest{“\ctxcommand{getbuffer("testbuffer")}\removeunwantedspaces”}
\starttext
\starttest TEST\stoptest
\starttest TEST \stoptest
\stoptext
It's a side effect of going through a file as tex then adds an endlinechar to the end of the file; you can try that with: \endlinechar=-1 just before the test code The \scantokens command has the same side effect. I've added \enabletrackers[buffers.grab] to track what gets into the buffer. The reason for this space is probably look-ahead although it makes perfect sense to have a mode for tex where no such space is added (probably then on a per file basis, maybe as part of the opener callback in luatex. In vmode the space is basically a nil, in hmode a \removeunwantedspaces is needed (as with other files). You can use buffers.getcontent to get the content directly (which might have catcode side effects. \def\processtest{“\ctxlua{context(buffers.getcontent("testbuffer"))}”} Hans ----------------------------------------------------------------- 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 -----------------------------------------------------------------