Nick Payne <[email protected]> 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


_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to