ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Mojca Miklavec" <mojca.miklavec.lists@gmail.com>
To: "mailing list for ConTeXt users" <ntg-context@ntg.nl>
Subject: Re: Buffers (gone) in MK IV (was: MK IV & Lilypond)
Date: Wed, 22 Aug 2007 00:53:32 +0200	[thread overview]
Message-ID: <6faad9f00708211553ve4d3d76s1a0ace13b6bd8693@mail.gmail.com> (raw)
In-Reply-To: <46CAD1C5.7050409@wxs.nl>

On 8/21/07, Hans Hagen wrote:
> 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.*

Thanks a lot for that one!

> % 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

I now tried to add the following three lines to t-lilypond.tex:

	\def\PDF{texmfstart --ifchanged=\lily!filename.eps pstopdf \lily!filename.eps}
	\beginLUATEX
	\savebuffer[lilypond-\the\lily!figures]%
	\endLUATEX
	\ifeof18
		\installprogram{\LP}%
etc.

But luaTeX now reports the following to console:

system (LUATEX) : [line 32] \savebuffer [lilypond-\the \lily!figures
]\endLUATEX \ifeof 18 \installprogram {\LP }\doif \jobsuffix
{pdf}{\installprogram {\PDF }}\else \executesystemcommand {\LP }\doif
\jobsuffix {pdf}{\executesystemcommand {\PDF }}\fi \doifelse
\jobsuffix {pdf} {\edef \lily!img {\lily!filename .pdf}}{\edef
\lily!img {\lily!filename .eps}}\ifvmode \getfiguredimensions
[\lily!filename .pdf]\leavevmode \newdimen \FigWidth \FigWidth
=\figurewidth \ifdim \FigWidth >\localhsize \!!dimena =\localhsize
\advance \!!dimena by-\FigWidth \noindent \hskip \!!dimena \fi \fi
\externalfigure [\lily!img ]\egroup

and then

systems         : end file li at line 34
 )
(\end occurred inside a group at level 1)

### simple group (level 1) entered at line 32 ({)
### bottom level
...
No pages of output.
Transcript written on li.log.


It seems like a problem with grouping, but I have no idea how to
prevent luaTeX from parsing the input further from what it's supposed
to read.

Mojca
___________________________________________________________________________________
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 22:53 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
2007-08-21 22:53   ` Mojca Miklavec [this message]
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=6faad9f00708211553ve4d3d76s1a0ace13b6bd8693@mail.gmail.com \
    --to=mojca.miklavec.lists@gmail.com \
    --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).