David Kastrup <d...@gnu.org> writes: > David Kastrup <d...@gnu.org> writes: > >> Eluze <elu...@gmail.com> writes: >> >>> LSR 507 <http://lsr.dsi.unimi.it/LSR/Item?id=507> produces erroneous >>> code since version 2.15.28: >>> >>> mus = { c4 d e f |} >>> >>> \displayLilyMusic \ghostMusic \mus >> >> That's fallout from issue 2240, Patch: Don't wrap EventChord around >> rhythmic events by default. It won't be the only affected item. >> >> The basic question is when should we be migrating the LSR to 2.16. >> >> In this particular case, only the first of several "adjacent" spacers is >> retained. The reason for that apparently is to avoid <c e> getting >> turned into what amounts to <s s>. I don't think that this >> simple-minded approach is all too likely to lead to sane results without >> more effort, even pre-2.15.28. So my take on this would be to just junk >> the music-filter expression. This is going to lead to constructs >> occasionally that one can't actually enter, but which should at least >> compile reasonably well. > > In a nutshell: > > ghostMusic = > #(define-music-function (parser location music) (ly:music? ) > (music-map (lambda (x) > (let ((dur (ly:music-property x 'duration))) > (if (ly:duration? dur) > (apply make-music 'SkipEvent > (flatten-alist > (ly:music-mutable-properties x))) > x))) > music)) > > > notes = { a2-"hello" b4 r b2 a-"bye" <c e g c' e' g'>1-"oho ;-)" } > > \ghostMusic \notes > > > This is not going to work out of the box with chord repetitions.
And here is a version that should work both with 2.14 as well as 2.16 and be fine with chord repetitions. ghostMusic = #(define-music-function (parser location music) (ly:music?) (music-map (lambda (x) (if (music-is-of-type? x 'rhythmic-event) (apply make-music 'SkipEvent (flatten-alist (ly:music-mutable-properties x))) x)) music)) notes = { a2-"hello" b4 r b2 a-"bye" <c e g c' e' g'>1-"oho ;-)" } \ghostMusic \notes With 2.16 proper, one would likely rather use map-some-music and (lambda (x) (and (music-is-of-type? ...) (apply ...))) -- David Kastrup _______________________________________________ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond