summaryrefslogtreecommitdiff
path: root/ly
diff options
context:
space:
mode:
authorDavid Kastrup <dak@gnu.org>2016-01-10 21:06:23 +0100
committerDavid Kastrup <dak@gnu.org>2016-01-18 17:20:18 +0100
commit03e7242dee487441073449fd8c3bfeb9afbc1678 (patch)
treee72b53d9443fd5474314e0d06749bb9eebb5843e /ly
parente567f6fdc3e452dbef271eb356b2098c31ce41f4 (diff)
Issue 4742: Only \propertyTweak rather than \tweak can be applied to overrides
\tweak should only tweak music as of issue 4533, so move the action of issue 4500 into \propertyTweak's definition instead.
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)