[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Discern post-event in music function
From: |
David Kastrup |
Subject: |
Re: Discern post-event in music function |
Date: |
Thu, 20 Apr 2017 18:06:14 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) |
Simon Albrecht <address@hidden> writes:
> Am 20.04.2017 um 17:25 schrieb address@hidden:
>> There's a `post-event?` predicate defined in
>> scm/define-music-display-methods.scm. I don't think that one's
>> easily accessible outside that module, but you can copy it:
>>
>> (define (post-event? m)
>> (music-is-of-type? m 'post-event))
>
> Here’s the resulting function:
>
> after =
> #(define-music-function (t e m) (ly:duration? ly:music? ly:music?)
> (let* ((post-event? (lambda (m)
> (music-is-of-type? m 'post-event)))
> (post (post-event? e)))
> #{
> \context Bottom <<
> #m
> {
> \skip $t
> #(if post
> #{ <> -\tweak extra-spacing-width #empty-interval $e #}
> e)
> }
> >>
> #}))
Well, one could just do
after =
#(define-music-function (t e m) (ly:duration? ly:music? ly:music?)
#{
\context Bottom <<
#m
{
\skip $t
<> $(tweak 'extra-spacing-width empty-interval e)
}
>>
#})
since the $ will produce the proper kind of event (post-event or not).
Admittedly, this is cheating quite a bit.
--
David Kastrup