From: David Kastrup Date: Sat, 27 Oct 2012 15:21:54 +0000 (+0200) Subject: Change \alterBroken interface to match that of other tweak/overrides X-Git-Tag: release/2.17.6-1~9^2~3 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=ec6b407a65c6da5a41fe2e3d250d67a20ee65e15;p=lilypond.git Change \alterBroken interface to match that of other tweak/overrides --- diff --git a/ly/music-functions-init.ly b/ly/music-functions-init.ly index b5af930f1d..edce98a9a0 100644 --- a/ly/music-functions-init.ly +++ b/ly/music-functions-init.ly @@ -86,24 +86,38 @@ markups), or inside a score.") 'break-permission 'allow)))) alterBroken = -#(define-music-function (parser location name property arg) - (symbol-list? symbol? list?) - (_i "Override @var{property} for pieces of broken spanner @var{name} with -values @var{arg}.") - ;; only apply override if grob is a spanner - (let ((description - (assoc-get (last name) all-grob-descriptions))) - (if (and description - (member 'spanner-interface - (assoc-get 'interfaces - (assoc-get 'meta description)))) - #{ - \override $name $property = - #(value-for-spanner-piece arg) - #} - (begin - (ly:input-warning location (_ "not a spanner name, `~a'") name) - (make-music 'SequentialMusic 'void #t))))) +#(define-music-function (parser location property arg item) + (symbol-list-or-symbol? list? symbol-list-or-music?) + (_i "Override @var{property} for pieces of broken spanner @var{item} +with values @var{arg}. @var{item} may either be music in the form of +a starting spanner event, or a symbol list in the form +@samp{Context.Grob} or just @samp{Grob}. Iff @var{item} is in the +form of a spanner event, @var{property} may also have the form +@samp{Grob.property} for specifying a directed tweak.") + (if (ly:music? item) + (if (eq? (ly:music-property item 'span-direction) START) + #{ \tweak #property #(value-for-spanner-piece arg) #item #} + (begin + (ly:music-warning item (_ "not a spanner")) + item)) + (let* ((p (check-grob-path item parser location + #:default 'Bottom + #:min 2 + #:max 2)) + (name (and p (second p))) + (description + (and name (assoc-get name all-grob-descriptions)))) + (if (and description + (member 'spanner-interface + (assoc-get 'interfaces + (assoc-get 'meta description)))) + #{ + \override #item . #property = + #(value-for-spanner-piece arg) + #} + (begin + (ly:input-warning location (_ "not a spanner name, `~a'") name) + (make-music 'Music)))))) appendToTag = #(define-music-function (parser location tag more music) diff --git a/python/convertrules.py b/python/convertrules.py index 28dad31843..6bf8f38b7a 100644 --- a/python/convertrules.py +++ b/python/convertrules.py @@ -3464,6 +3464,8 @@ def conv (str): + matchmarkup + ")?" + matcharg + ")(" + matcharg + r")?(\s+" + matchmarkup + r")(\s+\\default)?", patrep, str) + str = re.sub (r'''(\\alterBroken)(\s+[A-Za-z.]+)(''' + matcharg + + matcharg + ")", r"\1\3\2", str) return str # Guidelines to write rules (please keep this at the end of this file)