bug-lilypond
[Top][All Lists]
Advanced

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

Re: barNumberCheck broken in LilyPond 2.19.22


From: Thomas Morley
Subject: Re: barNumberCheck broken in LilyPond 2.19.22
Date: Sat, 4 Jul 2015 00:10:03 +0200

2015-07-03 21:07 GMT+02:00 markdblackwell <address@hidden>:
> If a user passes a wrong bar number to \barNumberCheck, LilyPond 2.19.22
> produces a Scheme error:
>
>>lilypond tiny-example.ly
> GNU LilyPond 2.19.22
> Processing `tiny-example.ly'
> Parsing...
> Interpreting
> music...C:/progra/lilypond/current/usr/share/lilypond/current/ly/music-functions-init.ly:220:24:
> In procedure ly:input-warning in expression (ly:input-warning (*location*)
> "Barcheck failed got ~a expect ~a" ...):
> C:/progra/lilypond/current/usr/share/lilypond/current/ly/music-functions-init.ly:220:24:
> Wrong type argument in position 1 (expecting Input): #f
>
> Tiny-example.ly contains the following code:
>
> \version "2.19.18" % Please ignore this version number!
> notes = {
> c'2 d'
>   \barNumberCheck #3
> }
> \book {
>   \bookOutputName "barNumberCheck-tiny-example-test"
>   \score {
>     \notes
>     \layout { }
>   }
> }
>
> I'm using Windows XP.



Confirmed on Linux.

Seems the call for (*location*) inside (make-music 'ApplyContext
'procedure ...) doesn't work.

As workaround use:

barNumberCheck =
#(define-music-function (n) (integer?)
   (_i "Print a warning if the current bar number is not @var{n}.")
   (let ((location (*location*)))
   ;(display "location: ")(display (*location*))
     (make-music 'ApplyContext
                 'procedure
                 (lambda (c)
                   (let ((cbn (ly:context-property c 'currentBarNumber)))
                   ;(display "location: ")(display (*location*))
                     (if (and  (number? cbn) (not (= cbn n)))
                         (ly:input-warning location
                                           "Barcheck failed got ~a expect ~a"
                                           cbn n)))))))


Cheers,
  Harm



reply via email to

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