Le 18/09/2022 à 22:43, Mats Bengtsson a écrit :
may this also be used in 2.22.2. ?
Now I errors :-(
Here is a version of the same snippet that should work in 2.22:
\version "2.22.2"
#(define-event-class 'event 'StreamEvent) % cough
"|" = { | #(make-music 'Event 'is-bar-check #t) }
#(define (Require_bar_check_engraver context)
(let ((heard #f)
(previous-rhythmic-ev #f)
(now-rhythmic-ev #f))
(make-engraver
(listeners
((event engraver event)
(if (ly:event-property event 'is-bar-check #f)
(set! heard #t)))
((rhythmic-event engraver event)
(set! now-rhythmic-ev event)))
((stop-translation-timestep engraver)
(if (and (not heard)
(ly:context-property context 'whichBar #f))
(if previous-rhythmic-ev
(ly:event-warning previous-rhythmic-ev "missing bar
check after this note/rest")
;; maybe \skip <music>, for which it is hard to get a
location
(ly:warning "missing bar check at end of measure ~a"
(1- (ly:context-property context
'currentBarNumber)))))
(set! heard #f)
(set! previous-rhythmic-ev now-rhythmic-ev)
(set! now-rhythmic-ev #f)))))
\layout {
\context {
\Voice
\consists #Require_bar_check_engraver
}
}
\addQuote kwote { c''''1 }
\relative c' {
c4 d e2 |
g1 |
g f e d | % notes wrongly entered
s1 % missing bar check
R1*3 |
}
Le 18/09/2022 à 22:16, Mats Bengtsson a écrit :
Brilliant! This will be in an include file that I will use for all my
future projects
Beware, though, that if you have things like
R1*10
they will start to warn because of the missing bar checks
between those measures.
It can probably be made to ignore MM rests written this
way. I'm too tired for this evening though.
(until it gets included in the LilyPond distribution).
I'm not willing to work on adding this feature in the
near future, but you could write to bug-lilypond to
state the feature request.