I'm coming back to this again. Here's the example below updated and a bit smaller:
\version "2.19.80"
makeStuff =
#(define-void-function () ()
(add-text #{\markup "fill some space" #})
(add-score #{ \score { \new Staff { c'1 } } #})
(add-text #{\markup "Keep with next"#})
; This doesn't work:
(add-score #{ \noPageBreak #})
(add-score #{ \score { \new Staff { c'1 } } #}))
\makeStuff
=======
Compiling the above results in this error:
=======
GNU LilyPond 2.19.80
Parsing...
Interpreting music...
Preprocessing graphical objects...lilypond: /home/gub/NewGub/gub/target/linux-64/src/lilypond-git.sv.gnu.org--lilypond.git-stable-2.20/lily/book.cc:258: void Book::process_score(SCM, Paper_book*, Output_def*): Assertion `0' failed.
Aborted
=======
The regular written out way is somehow adding the \noPageBreak directive differently which I haven't tracked down yet. (Using "(add-score #{ \score { \noPageBreak } #})" avoids the above error, but of course creates a blank staff.)
Essentially I have some functions which generate scores and markup (music/text is passed in and applied to a score template), but I don't have a way to control the page breaking between them. (E.g. explanatory text before an etude shouldn't have a line break). The main alternative I see is external code generation. This would solve some other issues with this method of generating scores (mostly bad line numbers in compile errors), but I'd prefer to not add another tool in the compile chain for the scores if possible.
Thanks.
-----Jay