\version "2.19.25" #(define anchor-color blue) % slightly modified/improved version of % alignTo from http://lists.gnu.org/archive/html/lilypond-user/2015-07/msg00235.html alignTo = #(define-music-function (conductor music) (ly:music? ly:music?) "Lengthen any note or rest in the sequence MUSIC just before each tag that matches a tag in the sequence CONDUCTOR, so that the tags occur at the same times from to the beginnings of MUSIC and CONDUCTOR." (define (find-sequence music) (or (fold-some-music (lambda (x) (music-is-of-type? x 'sequential-music)) (lambda (x e1) (or e1 ; use the first nonempty sequence (let ((es (ly:music-property x 'elements))) (if (null? es) #f es)))) #f music) (begin (ly:input-warning (ly:music-property music 'origin) "alignTo: cannot find sequential music") '()))) (let loop ((aligner (find-sequence conductor)) (alignee (find-sequence music)) (time-left (ly:music-length conductor))) (case (length alignee) ((0) music) ((1) music) (else (let* ((a (first alignee)) ; music that might be lengthened, (b (second alignee)) ; if this music is tagged ; if a has an until property, add this to tag (which is b’s tags) (tag (if (not (null? (ly:music-property a 'until))) (cons (ly:music-property a 'until) (ly:music-property b 'tags)) (ly:music-property b 'tags))) (tail (and (not (null? tag)) (find-tail (lambda (x) (not (null? (lset-intersection eq? tag (ly:music-property x 'tags))))) aligner)))) (if tail (let ((tail-length (ly:music-length (make-sequential-music tail)))) (if (ly:moment> #}) anchor = #(define-music-function (text) (string?) (if (ly:get-option 'point-and-click) #{ \tag #(string->symbol text) \single \override RehearsalMark.self-alignment-X = #LEFT \mark \markup \with-color #anchor-color #text #} #{ \tag #(string->symbol text) s1*0 #})) until = #(define-music-function (anchor) (string?) #{ \tag #(string->symbol anchor) s1*0 #}) % don’t redefine quoteUntil if advancedQuote.ily was included before % because of different transposition behaviour #(if (not (defined? 'quoteUntil)) (define quoteUntil (define-music-function (what anchor) (string? string?) (make-music 'QuoteMusic 'until (string->symbol anchor) 'quoted-music-name what))))