bug-lilypond
[Top][All Lists]
Advanced

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

Re: Double transpose when in tags within music function


From: David Kastrup
Subject: Re: Double transpose when in tags within music function
Date: Thu, 09 Jan 2014 13:03:37 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Ole V. Villumsen <address@hidden> writes:

> Expected behaviour of the example below: engrave a d (transpose the c to d).
> Actual behaviour: engraved an f. Seems to have done both of the
> transpositions described in the two different tags in the music function
> (transposed c to d, then to f, or the other way around).
>
> \version "2.18.0"
>
> myTranspose =
>   #(define-music-function(parser location theMusic) (ly:music?)
>      #{
>         \tag #'cd { \transpose c d #theMusic }
>         \tag #'df { \transpose d f #theMusic }
>      #})
>
> { \keepWithTag #'cd { \myTranspose { c'1 } } }
>
> The problem seems to be only when the tags are inside a music function (if
> this is not supposed to work, an appropriate error message should be given).
> The problem seems to be only with transposition; other music I put inside
> the tags gets filtered as expected.

No, it doesn't.  There are several other operations that will fail or
cause surprises.  Your mistake is using #theMusic twice without creating
a copy, so indeed the same music gets transposed twice and used twice.
Write $theMusic instead: that creates an actual copy.  Or write
#(ly:music-deep-copy theMusic) which is semantically the same as
$theMusic.

-- 
David Kastrup




reply via email to

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