summaryrefslogtreecommitdiff
path: root/ly
diff options
context:
space:
mode:
Diffstat (limited to 'ly')
-rw-r--r--ly/music-functions-init.ly77
1 files changed, 41 insertions, 36 deletions
diff --git a/ly/music-functions-init.ly b/ly/music-functions-init.ly
index 5c6fb24e6e..77ca2d0b00 100644
--- a/ly/music-functions-init.ly
+++ b/ly/music-functions-init.ly
@@ -1425,7 +1425,47 @@ property (inside of an alist) is tweaked.")
;; 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)))
@@ -1868,41 +1908,6 @@ property (inside of an alist) is tweaked.")
;; 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)