]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 4742: Only \propertyTweak rather than \tweak can be applied to overrides
authorDavid Kastrup <dak@gnu.org>
Sun, 10 Jan 2016 20:06:23 +0000 (21:06 +0100)
committerDavid Kastrup <dak@gnu.org>
Mon, 18 Jan 2016 16:20:18 +0000 (17:20 +0100)
\tweak should only tweak music as of issue 4533, so move the action of
issue 4500 into \propertyTweak's definition instead.

ly/music-functions-init.ly

index 5c6fb24e6ed04e773d5f41bc22d40d0a6c13b046..77ca2d0b007bb489e96b3aca2e5a76f6e20d003e 100644 (file)
@@ -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)