From 7b2cfcbba64a2e41c2d49e4806e0a4904f6c07c2 Mon Sep 17 00:00:00 2001 From: David Kastrup Date: Sun, 28 Oct 2012 14:10:15 +0100 Subject: [PATCH] Change \overrideProperty to take a single symbol-list as path --- ly/music-functions-init.ly | 49 +++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 27 deletions(-) diff --git a/ly/music-functions-init.ly b/ly/music-functions-init.ly index edce98a9a0..09607b1f06 100644 --- a/ly/music-functions-init.ly +++ b/ly/music-functions-init.ly @@ -720,33 +720,28 @@ of @var{base-moment}, @var{beat-structure}, and @var{beam-exceptions}.") (override-time-signature-setting time-signature setting))) overrideProperty = -#(define-music-function (parser location name property-path value) - (symbol-list? symbol-list-or-symbol? scheme?) - - (_i "Set @var{property-path} to @var{value} in all grobs named @var{name}. -The @var{name} argument is a symbol list of the form @code{Context.GrobName} -or @code{GrobName}.") - (if (<= 1 (length name) 2) - (make-music 'ApplyOutputEvent - 'context-type (if (null? (cdr name)) 'Bottom - (car name)) - 'procedure - (lambda (grob orig-context context) - (if (equal? - (cdr (assoc 'name (ly:grob-property grob 'meta))) - (last name)) - (if (symbol? property-path) - (ly:grob-set-property! grob property-path value) - (case (length property-path) - ((0) *unspecified*) - ((1) - (ly:grob-set-property! - grob (car property-path) value)) - (else - (ly:grob-set-nested-property! - grob property-path value))))))) - (begin - (ly:parser-error parser (_ "bad grob name") location) +#(define-music-function (parser location grob-property-path value) + (symbol-list? scheme?) + + (_i "Set the grob property specified by @var{grob-property-path} to +@var{value}. @var{grob-property-path} is a symbol list of the form +@code{Context.GrobName.property} or @code{GrobName.property}, possibly +with subproperties given as well.") + (let ((p (check-grob-path grob-property-path parser location + #:default 'Bottom + #:min 3))) + (if p + (make-music 'ApplyOutputEvent + 'context-type (first p) + 'procedure + (lambda (grob orig-context context) + (if (equal? + (cdr (assoc 'name (ly:grob-property grob 'meta))) + (second p)) + (if (null? (cdddr p)) + (ly:grob-set-property! grob (caddr p) value) + (ly:grob-set-nested-property! + grob (cddr p) value))))) (make-music 'Music)))) -- 2.39.2