Maurits Lamers <> writes:

> Hi, 
> Thanks for your suggestion! Do I understand from your reply that you
> don't think there is a dynamic option, ie without adjusting the
> lilypond code being processed?
> To clarify the context a bit: what I am doing is reviewing homework by
> students. This means that I am running my reviewer script (lilypond
> file with embedded guile with event listeners) as a side-load script
> through the -dinclude-settings option on the lilypond code files they
> provided.
> It is of course possible to preprocess the input files by appending
> such a scheme call (automatically). If I can have a dynamic option
> (such as listening to an event), I would rather like to have that
> option as it reduces the amount of things that can go wrong during
> processing.

All of the processing of top level expressions (also book level
expressions) is done through hooks.  You can replace those hooks with
your own, call the underlying function yourself, and then work with
stats.  It will still not give you an "end-of-file" hook, though.
However, if they don't use books for structuring the input, all
collected scores at the end of file are placed into one book and
processed then, so the book processing hook might still be good for you.

The respective hooks are set with

ly/ toplevel-book-handler print-book-with-defaults)
ly/ toplevel-bookpart-handler 
ly/ toplevel-music-handler collect-music-for-book)
ly/ toplevel-score-handler collect-scores-for-book)
ly/ toplevel-text-handler collect-scores-for-book)

David Kastrup

lilypond-user mailing list

Reply via email to