(add-quotable name music))
%% keep these two together
-afterGraceFraction = #(cons 6 8)
+afterGraceFraction = 3/4
afterGrace =
-#(define-music-function (main grace) (ly:music? ly:music?)
- (_i "Create @var{grace} note(s) after a @var{main} music expression.")
+#(define-music-function (fraction main grace) ((fraction?) ly:music? ly:music?)
+ (_i "Create @var{grace} note(s) after a @var{main} music expression.
+
+The musical position of the grace expression is after a
+given fraction of the main note's duration has passed. If
+@var{fraction} is not specified as first argument, it is taken from
+@code{afterGraceFraction} which has a default value of @code{3/4}.")
(let ((main-length (ly:music-length main))
- (fraction (ly:parser-lookup 'afterGraceFraction)))
+ (fraction (or fraction (ly:parser-lookup 'afterGraceFraction))))
(make-simultaneous-music
(list
main
(make-music 'SkipMusic
'duration (ly:make-duration
0 0
- (* (ly:moment-main-numerator main-length)
- (car fraction))
- (* (ly:moment-main-denominator main-length)
- (cdr fraction))))
+ (* (ly:moment-main main-length)
+ (/ (car fraction) (cdr fraction)))))
(make-music 'GraceMusic
'element grace)))))))
alterBroken =
#(define-music-function (property arg item)
- (symbol-list-or-symbol? list? symbol-list-or-music?)
+ (key-list-or-symbol? list? key-list-or-music?)
(_i "Override @var{property} for pieces of broken spanner @var{item}
with values @var{arg}. @var{item} may either be music in the form of
a starting spanner event, or a symbol list in the form
offset =
#(define-music-function (property offsets item)
- (symbol-list-or-symbol? scheme? symbol-list-or-music?)
+ (symbol-list-or-symbol? scheme? key-list-or-music?)
(_i "Offset the default value of @var{property} of @var{item} by
@var{offsets}. If @var{item} is a string, the result is
@code{\\override} for the specified grob type. If @var{item} is
overrideProperty =
#(define-music-function (grob-property-path value)
- (symbol-list? scheme?)
+ (key-list? scheme?)
(_i "Set the grob property specified by @var{grob-property-path} to
@var{value}. @var{grob-property-path} is a symbol list of the form
(if p
(make-music 'ApplyOutputEvent
'context-type (first p)
+ 'symbol (second p)
'procedure
(lambda (grob orig-context context)
- (if (equal?
- (cdr (assoc 'name (ly:grob-property grob 'meta)))
- (second p))
- (ly:grob-set-nested-property!
- grob (cddr p) value))))
+ (ly:grob-set-nested-property! grob (cddr p) value)))
(make-music 'Music))))
propertyOverride =
#(define-music-function (grob-property-path value)
- (symbol-list? scheme?)
+ (key-list? scheme?)
(_i "Set the grob property specified by @var{grob-property-path} to
@var{value}. @var{grob-property-path} is a symbol list of the form
@code{Context.GrobName.property} or @code{GrobName.property}, possibly
propertyRevert =
#(define-music-function (grob-property-path)
- (symbol-list?)
+ (key-list?)
(_i "Revert the grob property specified by @var{grob-property-path} to
its previous value. @var{grob-property-path} is a symbol list of the form
@code{Context.GrobName.property} or @code{GrobName.property}, possibly
propertyTweak =
#(define-music-function (prop value item)
- (symbol-list-or-symbol? scheme? symbol-list-or-music?)
+ (key-list-or-symbol? scheme? key-list-or-music?)
(_i "Add a tweak to the following @var{item}, usually music.
This generally behaves like @code{\\tweak} but will turn into an
@code{\\override} when @var{item} is a symbol list.
;; should only be attempted when the simple uses don't match the
;; given predicate.
(if (ly:music? item)
- (tweak prop value item)
+ (if (music-is-of-type? item 'context-specification)
+ ;; This is essentially dealing with the case
+ ;; \propertyTweak color #red \propertyTweak font-size #3 NoteHead
+ ;; namely when stacked tweaks end in a symbol list
+ ;; rather than a music expression.
+ ;;
+ ;; We have a tweak here to convert into an override,
+ ;; so we need to know the grob to apply it to. That's
+ ;; easy if we have a directed tweak, and otherwise we
+ ;; need to find the symbol in the expression itself.
+ (let* ((p (check-grob-path prop (*location*)
+ #:start 1
+ #:default #t
+ #:min 2))
+ (elt (ly:music-property item 'element))
+ (seq (if (music-is-of-type? elt 'sequential-music)
+ elt
+ (make-sequential-music (list elt))))
+ (elts (ly:music-property seq 'elements))
+ (symbol (if (symbol? (car p))
+ (car p)
+ (and (pair? elts)
+ (ly:music-property (car elts)
+ 'symbol)))))
+ (if (symbol? symbol)
+ (begin
+ (set! (ly:music-property seq 'elements)
+ (cons (make-music 'OverrideProperty
+ 'symbol symbol
+ 'grob-property-path (cdr p)
+ 'pop-first #t
+ 'grob-value value
+ 'origin (*location*))
+ elts))
+ (set! (ly:music-property item 'element) seq))
+ (begin
+ (ly:parser-error (_ "Cannot \\propertyTweak")
+ (*location*))
+ (ly:music-message item (_ "untweakable"))))
+ item)
+ (tweak prop value item))
(propertyOverride (append item (if (symbol? prop) (list prop) prop))
value)))
#(define-music-function (music)
(ly:music?)
(_i "Return @var{music} in reverse order.")
- (retrograde-music music))
+ (retrograde-music
+ (expand-repeat-notes!
+ (expand-repeat-chords!
+ (cons 'rhythmic-event
+ (ly:parser-lookup '$chord-repeat-events))
+ music))))
revertTimeSignatureSettings =
#(define-music-function
shape =
#(define-music-function (offsets item)
- (list? symbol-list-or-music?)
+ (list? key-list-or-music?)
(_i "Offset control-points of @var{item} by @var{offsets}. The
argument is a list of number pairs or list of such lists. Each
element of a pair represents an offset to one of the coordinates of a
(define (offset-control-points offsets)
(if (null? offsets)
coords
- (map
- (lambda (x y) (coord-translate x y))
- coords offsets)))
+ (map coord-translate coords offsets)))
(define (helper sibs offs)
(if (pair? offs)
tweak =
#(define-music-function (prop value music)
- (symbol-list-or-symbol? scheme? ly:music?)
+ (key-list-or-symbol? scheme? ly:music?)
(_i "Add a tweak to the following @var{music}.
Layout objects created by @var{music} get their property @var{prop}
set to @var{value}. If @var{prop} has the form @samp{Grob.property}, like with
;; p now contains at least two elements. The first
;; element is #t when no grob has been explicitly
;; specified, otherwise it is a grob name.
- ((music-is-of-type? music 'context-specification)
- ;; This is essentially dealing with the case
- ;; \tweak color #red \propertyTweak font-size #3 NoteHead
- ;; namely when stacked tweaks end in a symbol list
- ;; rather than a music expression.
- ;;
- ;; We have a tweak here to convert into an override,
- ;; so we need to know the grob to apply it to. That's
- ;; easy if we have a directed tweak, and otherwise we
- ;; need to find the symbol in the expression itself.
- (let* ((elt (ly:music-property music 'element))
- (seq (if (music-is-of-type? elt 'sequential-music)
- elt
- (make-sequential-music (list elt))))
- (elts (ly:music-property seq 'elements))
- (symbol (if (symbol? (car p))
- (car p)
- (and (pair? elts)
- (ly:music-property (car elts)
- 'symbol)))))
- (if (symbol? symbol)
- (begin
- (set! (ly:music-property seq 'elements)
- (cons (make-music 'OverrideProperty
- 'symbol symbol
- 'grob-property-path (cdr p)
- 'pop-first #t
- 'grob-value value
- 'origin (*location*))
- elts))
- (set! (ly:music-property music 'element) seq))
- (begin
- (ly:parser-error (_ "Cannot \\tweak")
- (*location*))
- (ly:music-message music (_ "untweakable"))))))
(else
(set! (ly:music-property music 'tweaks)
(acons (cond ((pair? (cddr p)) p)