Ole V. Villumsen <o...@villumsen.name> 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 _______________________________________________ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond