lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with point-and-click from within function


From: Urs Liska
Subject: Re: Problem with point-and-click from within function
Date: Thu, 11 Aug 2016 15:37:22 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0


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

Attachment: point-to-origin-2.ly
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]