--- /dev/null
+
+\header {
+
+ texidoc = "the @code{endSpanners} music function inserts
+end span events at the end of a note."
+
+}
+
+\version "2.11.15"
+\paper{
+ ragged-right = ##T
+}
+\relative
+<< { c'4 c c c }
+ \\
+ {
+ \override TextSpanner #'bound-details #'left #'text = "x"
+ \endSpanners c,2\<\startTextSpan c2
+
+ }
+ >>
+
(display-scheme-music music)
music)
+
+endSpanners =
+#(define-music-function (parser location music) (ly:music?)
+ (if (eq? (ly:music-property music 'name) 'EventChord)
+ (let*
+ ((elts (ly:music-property music 'elements))
+ (start-span-evs (filter (lambda (ev)
+ (and (music-has-type ev 'span-event)
+ (equal? (ly:music-property ev 'span-direction)
+ START)))
+ elts))
+ (stop-span-evs
+ (map (lambda (m)
+ (let* ((c (music-clone m)))
+ (set! (ly:music-property c 'span-direction) STOP)
+ c))
+ start-span-evs))
+ (end-ev-chord (make-music 'EventChord
+ 'elements stop-span-evs))
+ (total (make-music 'SequentialMusic
+ 'elements (list music
+ end-ev-chord))))
+ total)
+
+ (ly:input-message location (_ "argument endSpanners is not an EventChord: ~a" music))))
+
featherDurations=
#(define-music-function (parser location factor argument) (ly:moment? ly:music?)
(_i "Rearrange durations in ARGUMENT so there is an
(lambda (m) (eq? 'NoteEvent (ly:music-property m 'name)))
(ly:music-property ev-chord 'elements))))
(sec-note-events (get-notes secondary-note))
- (trill-events (filter (lambda (m) (memq 'trill-span-event (ly:music-property m 'types)))
+ (trill-events (filter (lambda (m) (music-has-type m 'trill-span-event))
(ly:music-property main-note 'elements)))
(trill-pitch
(define-public (empty-music)
(ly:export (make-music 'Music)))
-;;;
- ; Make a function that checks score element for being of a specific type.
+;; Make a function that checks score element for being of a specific type.
(define-public (make-type-checker symbol)
(lambda (elt)
;;(display symbol)
mus))
+(define-public (music-has-type music type)
+ (memq type (ly:music-property music 'types)))
+
+(define-public (music-clone music)
+ (define (alist->args alist acc)
+ (if (null? alist)
+ acc
+ (alist->args (cdr alist)
+ (cons (caar alist) (cons (cdar alist) acc)))))
+
+ (apply
+ make-music
+ (ly:music-property music 'name)
+ (alist->args (ly:music-mutable-properties music) '())))
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; warn for bare chords at start.