Am 11.08.2016 um 13:35 schrieb Malte Meyn:
>
>
> Am 11.08.2016 um 13:29 schrieb Malte Meyn:
>>
>>
>> Am 11.08.2016 um 13:00 schrieb Urs Liska:
>>> After some experimentation I have the impression this is related to a
>>> phenomenon I see in the attached file. The three functions all return
>>> the original music, but somewhat differently. The point I'm wondering
>>> about is: why does the point-and-click link sometimes (expectedly)
>>> point
>>> to the music but sometimes to the function invocation?
>>
>> I had a similar “problem” some days ago when I was arranging some music
>> and had conditionals for testing different versions: The following code
>> sets point-and-click links to the opening parenthesis of the #(if …).
>> Can this be changed using (*parser*) and (*location*) somehow?
>>
>> \version "2.19.46"
>>
>> #(define foo #t)
>>
>> \relative {
>> f' f f f e2 e
>> #(if foo
>> #{ g4 g g g c,1 #}
>> #{ d4 d d d c1 #})
>> }
>
> Nevermind. I just had an idea which works as expected. Sorry for the
> noise.
>
> %%%%%%%
>
> \version "2.19.46"
>
> #(define foo #f)
>
> altMusic =
> #(define-music-function
> (sym alt1 alt2)
> (symbol? ly:music? ly:music?)
> (if foo alt1 alt2))
>
> \relative {
> f' f f f e2 e
> \altMusic #'foo
> { g4 g g g c,1 }
> { d4 d d d c1 }
> }
>
The difference between the solution is that the two music alternatives
are enclosed in curly braces. This made me try the attached approach.
Interestingly it works both when the function adds the additional brace
level or when the input pitch is enclosed in an expression. Obviously,
when returning both the override and the music (funcB of my first
example) LilyPond adds this wrapper level implicitly.
Unfortunately I didn't manage to get it working with the music function
(the \parenthesize). But it's a step forward, at least.
Urs
\version "2.19.47"
funcA =
#(define-music-function (mus)(ly:music?)
#{
#mus
#})
funcB =
#(define-music-function (mus)(ly:music?)
#{
{
#mus
}
#})
{
% funcA: point-and-click points to function invocation
\funcA c'
% funcB: point-and-click points to music
\funcB d'
% funcA: *now* point-and-click *also* points to music
\funcA { e' }
}
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user