[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Scheme global variables in Lilypond
From: |
David Kastrup |
Subject: |
Re: Scheme global variables in Lilypond |
Date: |
Tue, 01 Jan 2013 20:18:21 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
Nick Payne <address@hidden> writes:
> #(define dirn 1)
>
> #(define (updown grob)
> (let ((ud (ly:event-property (event-cause grob) 'direction)))
> (if (eq? -1 ud)
> (begin
> (set! dirn DOWN)
> DOWN)
> UP)))
>
> beginStringNum = #(define-event-function (parser location strng)
> (number?)
> #{
> \tweak direction #updown
> \tweak bound-details.right.text \markup {
> \draw-line #(cons 0 (/ dirn -2)) }
> \startTextSpan
> #}
> )
> endStringNum = \stopTextSpan
>
> \relative c' {
> \displayLilyMusic { c4_\beginStringNum 5 c c c\endStringNum }
> }
> %==============
>
> I get this shown on the console:
>
> { c-\tweak direction #updown -\tweak #t.(bound-details right text)
> #'(#<procedure line-markup (layout props args)> ((#<procedure
> draw-line-markup (layout props dest)> (0 . -1/2)))) _\startTextSpan c
> c c\stopTextSpan }
>
> Does that mean that the hardcoded initial value of the dirn variable
> is being substituted in the second tweak before the updown function is
> called?
Sure. That's what I have been saying all along. updown is called in
the backend, not before.
This also means that tweaks of subproperties are not displayed
properly. Sigh.
--
David Kastrup