]> git.donarmstrong.com Git - lilypond.git/commitdiff
Add type-checking to \tweak.
authorNeil Puttock <n.puttock@gmail.com>
Thu, 30 Apr 2009 19:29:09 +0000 (20:29 +0100)
committerPatrick McCarty <pnorcks@gmail.com>
Fri, 17 Jul 2009 09:26:43 +0000 (02:26 -0700)
Signed-off-by: Patrick McCarty <pnorcks@gmail.com>
ly/music-functions-init.ly

index daf0990cbc07b2080827e0b4249f94e1c030c23e..44999b6c35551055d0673bd60a2df343ec2ba089 100644 (file)
@@ -694,7 +694,8 @@ scoreTweak =
        (make-music 'SequentialMusic)))
 
 
-tag = #(define-music-function (parser location tag arg)
+tag =
+#(define-music-function (parser location tag arg)
    (symbol? ly:music?)
 
    (_i "Add @var{tag} to the @code{tags} property of @var{arg}.")
@@ -738,16 +739,20 @@ transposition =
                       (ly:pitch-negate (pitch-of-note pitch-note)))
         'Staff))
 
-tweak = #(define-music-function (parser location sym val arg)
-          (symbol? scheme? ly:music?)
+tweak =
+#(define-music-function (parser location sym val arg)
+   (symbol? scheme? ly:music?)
+   (_i "Add @code{sym . val} to the @code{tweaks} property of @var{arg}.")
 
-          (_i "Add @code{sym . val} to the @code{tweaks} property of @var{arg}.")
-          
-          (set!
-           (ly:music-property arg 'tweaks)
-           (acons sym val
-                  (ly:music-property arg 'tweaks)))
-          arg)
+   (if (equal? (object-property sym 'backend-type?) #f)
+       (begin
+        (ly:warning (_ "cannot find property type-check for ~a") sym)
+        (ly:warning (_ "doing assignment anyway"))))
+   (set!
+    (ly:music-property arg 'tweaks)
+    (acons sym val
+          (ly:music-property arg 'tweaks)))
+   arg)