ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Henning Hraban Ramm <hraban@fiee.net>
Subject: Re: Buffers (gone) in MK IV (was: MK IV & Lilypond)
Date: Tue, 21 Aug 2007 13:51:33 +0200	[thread overview]
Message-ID: <46CAD1C5.7050409@wxs.nl> (raw)
In-Reply-To: <6faad9f00708210424s770aeeb4ja42f758bd768d603@mail.gmail.com>

Mojca Miklavec wrote:
> On 8/21/07, David Wooten wrote:
>> Greetings all,
>>
>> Has anyone had any luck getting the lilypond module to work with mkiv/
>> luatex engine? It fails for me (works fine with mkii/pdftex). I can
>> send along some log info if others have found it to work.
> 
> Hans has mentioned several times that buffers are not going to be
> written to files with luaTeX any more. This has a weird consequence on
> many modules which relied exactly on that trick.
> 
> Short example of what goes wrong:
> 
> \starttext
> 
> \startbuffer[a]
> Hello world!
> \stopbuffer
> \typebuffer[a]
> 
> %\executesystemcommand{dosomethingwith \jobname-a.tmp}
> \stoptext
> 
> The problem is that MK II created a file \jobname-a.tmp and lilypond
> module processed exactly that file further. In MK IV, that file is not
> created any more (you can check that by running the above example with
> --lua first and then with pdfTeX again. Only in the second case a file
> [whateverthefilename]-a.tmp is created.)
> 
> Lilypond module relied on that "feature" (I would rather call it
> dirty-but-very-useful-trick).
> 
> Hans, what's the current general recipe for this kind of [mis]use of buffers?

I'll add savebuffer to core-buf.*

% engine=luatex

\startluacode
     if not buffers.save then
         function buffers.save(name)
             if not name or name == "" then
                 name = tex.jobname
             end
             local b, f = buffers.data[name], 
string.format("%s-%s.tmp",tex.jobname,name)
             b = (b and type(b) == "table" and table.join(b)) or b or ""
             io.savedata(f,b)
         end
     end
\stopluacode

\def\savebuffer{\dosingleempty\dosavebuffer}

\def\dosavebuffer[#1]{\ctxlua{buffers.save("#1")}}

\starttext

\startbuffer[oeps]
oeps
\stopbuffer

\startbuffer
oepsoeps
\stopbuffer

\savebuffer[oeps] \savebuffer

\stoptext



-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


  reply	other threads:[~2007-08-21 11:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-21 11:24 Mojca Miklavec
2007-08-21 11:51 ` Hans Hagen [this message]
2007-08-21 22:53   ` Mojca Miklavec
2007-08-22  8:05     ` Buffers (gone) in MK IV Hans Hagen
2007-08-25 18:49     ` Buffers (gone) in MK IV (was: MK IV & Lilypond) David Wooten
2007-08-26  8:35       ` Mojca Miklavec

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=46CAD1C5.7050409@wxs.nl \
    --to=pragma@wxs.nl \
    --cc=hraban@fiee.net \
    --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).