Thanks a lot! Much appreciated!
I hope you didn't mind that I added it to the Lilypond Wiki,
https://wiki.lilypond.community/wiki/Warn_about_missing_repeat
Best,
/Mats
On 11/23/25 18:24, Lukas-Fabian Moser
wrote:
Hi Mats,
Am 23.11.25 um 17:41 schrieb Mats Bengtsson:
Something like this? The idea is that we expect repeats to be stated explicitly in each Staff context.
A challenge for the Lilypond hacker gurus: Would it be possible to design a custom engraver/function/..., that triggers a warning if you typeset a score where some, but not all the parts have a repeat at the same spot?
As you may guess, I just found a missing repeat in one part of a piece I have typeset, where I had carefully proof read all the original parts against the LilyPond generated score, but hadn't proof read the individual parts.
Obviously, there are many situations where this warning wouldn't be desired, for example when you have different lyrics in the repeats, so it shouldn't be triggered by default. Still, it would be a nice feature to be able to activate from time to time.
Lukas
\version "2.25.23"
#(define Repeat_warn_engraver
(let
((repeat-start-anywhere? #f)) ; shared across all instances
(lambda (ctx)
(let ((repeat-start-local? #f)) ; local for one context
(make-engraver
((start-translation-timestep engraver)
(set! repeat-start-anywhere? #f))
(listeners
((volta-repeat-start-event engraver event)
(set! repeat-start-anywhere? #t)
(set! repeat-start-local? #t)))
((stop-translation-timestep engraver)
(if (and repeat-start-anywhere?
(not repeat-start-local?))
(ly:warning "Global repeat not stated in context ~a" ctx))
(set! repeat-start-local? #f)))))))
\layout {
\context {
\Staff
\consists #Repeat_warn_engraver
}
}
<<
\new Staff = upper {
c'1
\repeat volta 2 { c' c' c' }
\repeat volta 2 {
d
}
}
\new Staff = lower {
c'1
\repeat volta 2 { c' c' c' }
% \repeat volta 2 {
e
% }
}
>>
