ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Mohamed Bana <mbana.lists@googlemail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Verbatim / prettyprinting in mkIV
Date: Mon, 08 Jun 2009 13:16:50 +0100	[thread overview]
Message-ID: <4A2D0132.5090501@googlemail.com> (raw)
In-Reply-To: <20090608114621.GB12271@katherina.student.utwente.nl>

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
___________________________________________________________________________________


      parent reply	other threads:[~2009-06-08 12:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-08 11:46 Matthijs Kooijman
2009-06-08 12:01 ` Hans Hagen
2009-06-08 12:16 ` Mohamed Bana [this message]

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=4A2D0132.5090501@googlemail.com \
    --to=mbana.lists@googlemail.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).