\version "2.15.38"
#(define bars-per-line 4)
#(define line-break-every-nth-engraver
(lambda (context)
(make-engraver
(acknowledgers ((paper-column-interface engraver grob source-engraver)
(let ((current-bar (ly:context-property context 'currentBarNumber)))
(if (= (remainder current-bar bars-per-line) 1)
(if (eq? #t (ly:grob-property grob 'non-musical))
(set! (ly:grob-property grob 'line-break-permission) 'force)
(set! (ly:grob-property grob 'line-break-permission) '())))))))))
\relative c' {
\repeat unfold 10 {
\time 2/4
c4 c
\time 4/4
c c c c
\time 3/4
c c c
\time 1/4
c
\time 5/4
c c c c c
\time 7/4
c c c c c c c
\time 2/4
c c
\time 7/8
c8 c c c c c c
\time 2/2
c2 c
}
}
\layout {
\context {
\Score
%% the following line necessary if you want to put more
%% measures to a line than Lily wants to allow
\override NonMusicalPaperColumn #'line-break-permission = ##f
\consists #line-break-every-nth-engraver
}
}