ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Verbatim / prettyprinting in mkIV
@ 2009-06-08 11:46 Matthijs Kooijman
  2009-06-08 12:01 ` Hans Hagen
  2009-06-08 12:16 ` Mohamed Bana
  0 siblings, 2 replies; 3+ messages in thread
From: Matthijs Kooijman @ 2009-06-08 11:46 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 3233 bytes --]

Hi all,

I've been struggling with verbatim printing in MkIV for a while now and found
some confusing things. I did finally get things working, but after quite some
effort. I'd like to hear if my conclusions are correct, perhaps I can put them
on the wiki then.

I was trying to set up some custom pretty printing scripts, using lua (since
I'd rather not learn complete tex scripting :-p). Looking at the files in
/usr/share/texmf/tex/context/base and the wiki (Verbatim_text talks about
verb-foo.tex files), I created a file called verb-foo.lua. I put this beside
my document at first, and then in /usr/share/texmf/tex/context/base when it
did not work, but neither worked. I tried setting things up as follows:

\installprettytype [FOO] [FOO]
\definetyping[FOO][option=FOO]

\startFOO
  blub
\stopFOO

Trying to trace the code, I worked out things should work as follows:

\installprettytype sets the "evalue" \??ty\??tyFOO to point at FOO
\definetyping call \setupprettiesintypeFOO, which finds looks up the above
evalue, finds FOO and then turns that into verb-foo and calls
\ctxloadluafile{verb-foo}{}. This sets up the buffers.visualizers.foo value in
lua. When actually starting a typing environment, dodotypeA or dodotypeD call
buffers.hooks.flush_line, which in turn calls
buffers.visualizers.foo.flush_line.

The above didn't happen for me, so I tried manually loading the lua file using
\ctxloadluafile{verb-foo}{}. After this, things started working for some reason.

When looking closer and installing some \writestatus lines in core-ver.mkiv, I
found that \setupprettiesintype was never actually called! Closer inspection
showed that the entire core-ver.mkiv is never loaded when running "context
--make". However, there is a second file, buff-ver.mkiv which closely
resembles core-ver.mkiv and which is loaded. An important difference, however,
is that buff-ver loads pret-foo instead of verb-foo (or rather, uses the value
of \f!prettyprefix, which is set to "pret-" in mult-sys.tex).

Renaming my lua file to pret-foo.lua made context find it exactly as it
should, also when putting the file next to the main document.

So, my main question was, are the verb-*.lua and core-ver.text files still
used in any way? I just checked the minimals tree, and found out they have
been removed already (but I didn't have -d in my rsync commandline to actually
remove them). Looking at the previous version I was running (2009.05.20 beta)
it seems that this change was actually pretty recent, so I mostly created this
confusing situation by upgrading today (because my verbatim file was not
properly loaded). I'm not so sure why it was not working before then, but at
least it is working now.

Heh, this is what you get when you write an email while you are still trying
things out. All this buildup to get to a question, when the question is not
even relevant. As for another relevant question: Is my analysis of how things
are supposed to work correct? Then I might put something like it on the wiki.

Also, it seems that \ctxloadluafile does not give an error when the file was
not found. If it would have, things would probably have been a lot easier. Is
there any compelling reason to make it fail silently?

Gr.

Matthijs

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

[-- Attachment #2: Type: text/plain, Size: 487 bytes --]

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Verbatim / prettyprinting in mkIV
  2009-06-08 11:46 Verbatim / prettyprinting in mkIV Matthijs Kooijman
@ 2009-06-08 12:01 ` Hans Hagen
  2009-06-08 12:16 ` Mohamed Bana
  1 sibling, 0 replies; 3+ messages in thread
From: Hans Hagen @ 2009-06-08 12:01 UTC (permalink / raw)
  To: ntg-context

Matthijs Kooijman wrote:
> Hi all,
> 
> I've been struggling with verbatim printing in MkIV for a while now and found
> some confusing things. I did finally get things working, but after quite some
> effort. I'd like to hear if my conclusions are correct, perhaps I can put them
> on the wiki then.

mkiv only has tex, mp and lua pretty printing and uses a different 
method than mkii (the mkii pretty print files are not used at all)

> --make". However, there is a second file, buff-ver.mkiv which closely
> resembles core-ver.mkiv and which is loaded. An important difference, however,
> is that buff-ver loads pret-foo instead of verb-foo (or rather, uses the value
> of \f!prettyprefix, which is set to "pret-" in mult-sys.tex).

indeed, as part of the split (and code freeze of mkii) some core-* files 
have been regrouped

> So, my main question was, are the verb-*.lua and core-ver.text files still
> used in any way? 

no

(it's no problem to add more mkiv pretty printers; one can take the lua 
one as template)

Hans

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Verbatim / prettyprinting in mkIV
  2009-06-08 11:46 Verbatim / prettyprinting in mkIV Matthijs Kooijman
  2009-06-08 12:01 ` Hans Hagen
@ 2009-06-08 12:16 ` Mohamed Bana
  1 sibling, 0 replies; 3+ messages in thread
From: Mohamed Bana @ 2009-06-08 12:16 UTC (permalink / raw)
  To: mailing list for ConTeXt users

the author of the latex 'listing' package showed some interest in 
porting the code to ConTeXt.  Perhaps someone could contact him.

Matthijs Kooijman wrote:
> Hi all,
> 
> I've been struggling with verbatim printing in MkIV for a while now and found
> some confusing things. I did finally get things working, but after quite some
> effort. I'd like to hear if my conclusions are correct, perhaps I can put them
> on the wiki then.
> 
> I was trying to set up some custom pretty printing scripts, using lua (since
> I'd rather not learn complete tex scripting :-p). Looking at the files in
> /usr/share/texmf/tex/context/base and the wiki (Verbatim_text talks about
> verb-foo.tex files), I created a file called verb-foo.lua. I put this beside
> my document at first, and then in /usr/share/texmf/tex/context/base when it
> did not work, but neither worked. I tried setting things up as follows:
> 
> \installprettytype [FOO] [FOO]
> \definetyping[FOO][option=FOO]
> 
> \startFOO
>   blub
> \stopFOO
> 
> Trying to trace the code, I worked out things should work as follows:
> 
> \installprettytype sets the "evalue" \??ty\??tyFOO to point at FOO
> \definetyping call \setupprettiesintypeFOO, which finds looks up the above
> evalue, finds FOO and then turns that into verb-foo and calls
> \ctxloadluafile{verb-foo}{}. This sets up the buffers.visualizers.foo value in
> lua. When actually starting a typing environment, dodotypeA or dodotypeD call
> buffers.hooks.flush_line, which in turn calls
> buffers.visualizers.foo.flush_line.
> 
> The above didn't happen for me, so I tried manually loading the lua file using
> \ctxloadluafile{verb-foo}{}. After this, things started working for some reason.
> 
> When looking closer and installing some \writestatus lines in core-ver.mkiv, I
> found that \setupprettiesintype was never actually called! Closer inspection
> showed that the entire core-ver.mkiv is never loaded when running "context
> --make". However, there is a second file, buff-ver.mkiv which closely
> resembles core-ver.mkiv and which is loaded. An important difference, however,
> is that buff-ver loads pret-foo instead of verb-foo (or rather, uses the value
> of \f!prettyprefix, which is set to "pret-" in mult-sys.tex).
> 
> Renaming my lua file to pret-foo.lua made context find it exactly as it
> should, also when putting the file next to the main document.
> 
> So, my main question was, are the verb-*.lua and core-ver.text files still
> used in any way? I just checked the minimals tree, and found out they have
> been removed already (but I didn't have -d in my rsync commandline to actually
> remove them). Looking at the previous version I was running (2009.05.20 beta)
> it seems that this change was actually pretty recent, so I mostly created this
> confusing situation by upgrading today (because my verbatim file was not
> properly loaded). I'm not so sure why it was not working before then, but at
> least it is working now.
> 
> Heh, this is what you get when you write an email while you are still trying
> things out. All this buildup to get to a question, when the question is not
> even relevant. As for another relevant question: Is my analysis of how things
> are supposed to work correct? Then I might put something like it on the wiki.
> 
> Also, it seems that \ctxloadluafile does not give an error when the file was
> not found. If it would have, things would probably have been a lot easier. Is
> there any compelling reason to make it fail silently?
> 
> Gr.
> 
> Matthijs
> 
> 
> ------------------------------------------------------------------------
> 
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-06-08 12:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-08 11:46 Verbatim / prettyprinting in mkIV Matthijs Kooijman
2009-06-08 12:01 ` Hans Hagen
2009-06-08 12:16 ` Mohamed Bana

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).