\version "2.15.37"
\relative c'' {
\override Score.BarNumber #'break-visibility = #'#(#f #t #t)
\override Score.BarNumber #'stencil =
#(lambda (grob)
(let* ((stil (ly:text-interface::print grob))
(text (ly:grob-property grob 'text))
((markup->string text) (string->number text)))
(if (= (remainder (markup->string text) 5) 0)
(ly:grob-set-property! grob 'color red)
(ly:grob-set-property! grob 'color black))
stil))
\repeat unfold 41 { c1 }
}

I try replacing nmbr with (markup->string text) as suggest by David Nalesnik 
and I get the following error.  Appreciate help.


Starting lilypond.exe 2.15.37 [lily_test-bar-number.ly]... 
Processing `lily_test-bar-number.ly'
Parsing...
Interpreting music... [8][16][24][32][40]
Preprocessing graphical objects...lily_test-bar-number.ly:9:21: In procedure 
memoization in expression (let* (# # #) (if # # ...) ...):
lily_test-bar-number.ly:9:21: In file "lily_test-bar-number.ly", line 10: Bad 
variable (markup->string text) in expression (let* ((stil 
(ly:text-interface::print grob)) (text (ly:grob-property grob (quote text))) 
((markup->string text) (string->number text))) (if (= (remainder 
(markup->string text) 5) 0) (ly:grob-set-property! grob (quote color) red) 
(ly:grob-set-property! grob (quote color) black)) stil).
Exited with return code 1.
 
Blessing in+,


>________________________________
>
>
>Date: Sun, 29 Apr 2012 18:07:33 -0500
>From: David Nalesnik <david.nales...@gmail.com>
>To: Thomas Morley <thomasmorle...@googlemail.com>
>Cc: lilypond-user <lilypond-user@gnu.org>
>Subject: Re: BarNumber-value?
>Message-ID:
>    <CANn-nXk-uNvVRm+Brc7y-Yze7mXSMUOm-R1AvOXe=zxquo8...@mail.gmail.com>
>Content-Type: text/plain; charset="iso-8859-1"
>
>Hi Harm,
>
>On Sun, Apr 29, 2012 at 5:55 PM, Thomas Morley <
>thomasmorle...@googlemail.com> wrote:
>
>> Hi,
>>
>> in 2.14.2 I used a function to manipulate the BarNumber-stencil. It
>> calls the value of the BarNumber as a string, via (ly:grob-property
>> grob 'text).
>>
>> This doesn't work no longer with the latest devel-versions. (Due to
>> the changes in Issue 2059 ?)
>>
>> (ly:grob-property grob 'text) now returns, e.g. (#<procedure
>> line-markup (layout props args)> ("2"))
>>
>> How to do with 2.15.36?
>>
>> Below a simplified example.
>>
>> \version "2.14.2"
>>
>> \relative c'' {
>>
>>        \override Score.BarNumber #'break-visibility = #'#(#f #t #t)
>>        \override Score.BarNumber #'stencil =
>>                  #(lambda (grob)
>>                    (let* ((stil (ly:text-interface::print grob))
>>                           (text (ly:grob-property grob 'text))
>>                           (nmbr (string->number text)))
>>                    (if (= (remainder nmbr 5) 0)
>>                       (ly:grob-set-property! grob 'color red)
>>                       (ly:grob-set-property! grob 'color black))
>>                    stil))
>>
>>        \repeat unfold 41 { c1 }
>> }
>>
>
>Lucky guess, but replacing text in your definition of nmbr with the
>following gets me a red number every five bars with 2.15.37:
>
>(markup->string text)
>
>-David
>-------------- next part --------------
>An HTML attachment was scrubbed...
>URL: 
><http://lists.gnu.org/archive/html/lilypond-user/attachments/20120429/866be2bf/attachment.html>
>
>------------------------------
>
>Date: Mon, 30 Apr 2012 01:41:36 +0200
>From: Thomas Morley <thomasmorle...@googlemail.com>
>To: David Nalesnik <david.nales...@gmail.com>
>Cc: lilypond-user <lilypond-user@gnu.org>
>Subject: Re: BarNumber-value?
>Message-ID:
>    <cabsfgyxbjtasrhfucmdvvnevrqzftsg17jsas7rwwezxtsv...@mail.gmail.com>
>Content-Type: text/plain; charset=ISO-8859-1
>
>Hi David,
>
>2012/4/30 David Nalesnik <david.nales...@gmail.com>:
>> Hi Harm,
>>
>> On Sun, Apr 29, 2012 at 5:55 PM, Thomas Morley
>> <thomasmorle...@googlemail.com> wrote:
>>>
>>> Hi,
>>>
>>> in 2.14.2 I used a function to manipulate the BarNumber-stencil. It
>>> calls the value of the BarNumber as a string, via (ly:grob-property
>>> grob 'text).
>>>
>>> This doesn't work no longer with the latest devel-versions. (Due to
>>> the changes in Issue 2059 ?)
>>>
>>> (ly:grob-property grob 'text) now returns, e.g. (#<procedure
>>> line-markup (layout props args)> ("2"))
>>>
>>> How to do with 2.15.36?
>>>
>>> Below a simplified example.
>>>
>>> \version "2.14.2"
>>>
>>> \relative c'' {
>>>
>>> ? ? ? ?\override Score.BarNumber #'break-visibility = #'#(#f #t #t)
>>> ? ? ? ?\override Score.BarNumber #'stencil =
>>> ? ? ? ? ? ? ? ? ?#(lambda (grob)
>>> ? ? ? ? ? ? ? ? ? ?(let* ((stil (ly:text-interface::print grob))
>>> ? ? ? ? ? ? ? ? ? ? ? ? ? (text (ly:grob-property grob 'text))
>>> ? ? ? ? ? ? ? ? ? ? ? ? ? (nmbr (string->number text)))
>>> ? ? ? ? ? ? ? ? ? ?(if (= (remainder nmbr 5) 0)
>>> ? ? ? ? ? ? ? ? ? ? ? (ly:grob-set-property! grob 'color red)
>>> ? ? ? ? ? ? ? ? ? ? ? (ly:grob-set-property! grob 'color black))
>>> ? ? ? ? ? ? ? ? ? ?stil))
>>>
>>> ? ? ? ?\repeat unfold 41 { c1 }
>>> }
>>
>>
>> Lucky guess, but replacing text in your definition of nmbr with the
>> following gets me a red number every five bars with 2.15.37:
>>
>> (markup->string text)
>>
>> -David
>>
>
>that's it.
>
>Thanks again,
>  Harm
>
>
>
>------------------------------
>
>_______________________________________________
>lilypond-user mailing list
>lilypond-user@gnu.org
>https://lists.gnu.org/mailman/listinfo/lilypond-user
>
>
>End of lilypond-user Digest, Vol 113, Issue 99
>**********************************************
>
>
>
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to