lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: End of file event


From: David Kastrup
Subject: Re: End of file event
Date: Thu, 22 Feb 2018 10:00:10 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Maurits Lamers <address@hidden> 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/declarations-init.ly:#(define toplevel-book-handler print-book-with-defaults)
ly/declarations-init.ly:#(define toplevel-bookpart-handler 
collect-bookpart-for-book)
ly/declarations-init.ly:#(define toplevel-music-handler collect-music-for-book)
ly/declarations-init.ly:#(define toplevel-score-handler collect-scores-for-book)
ly/declarations-init.ly:#(define toplevel-text-handler collect-scores-for-book)


-- 
David Kastrup



reply via email to

[Prev in Thread] Current Thread [Next in Thread]