From 1852e9dcde943766fd995add90afb0ea418931ba Mon Sep 17 00:00:00 2001 From: Neil Puttock Date: Thu, 30 Apr 2009 20:29:09 +0100 Subject: [PATCH] Add type-checking to \tweak. Signed-off-by: Patrick McCarty --- ly/music-functions-init.ly | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/ly/music-functions-init.ly b/ly/music-functions-init.ly index daf0990cbc..44999b6c35 100644 --- a/ly/music-functions-init.ly +++ b/ly/music-functions-init.ly @@ -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) -- 2.39.5