Aaron Hill <lilyp...@hillvisions.com> writes:

> No need to rewrite anything.  We can use \with to assist with this
> pattern:
>
> %%%%
> overrideII =
> #(define-music-function
>   (prop mods)
>   (key-list? ly:context-mod?)
>   (define (assign? mod) (eq? 'assign (car mod)))
>   (define (proc mod)
>     (let ((subprop (cadr mod))
>           (value (caddr mod)))
>       #{ \override #prop . #subprop = #value #}))
>   #{ #@(map proc (filter assign? (ly:get-context-mods mods))) #})
> %%%%
>
> While there is almost certainly a better name than overrideII, it
> permits the following:
>
> %%%%
> \once \override FretBoard.fret-diagram-details.barre-type = #'none
> \once \override FretBoard.fret-diagram-details.number-type = #'arabic
> \once \override FretBoard.fret-diagram-details.orientation = #'landscape
> \once \override FretBoard.fret-diagram-details.mute-string = #"M"
> \once \override FretBoard.fret-diagram-details.label-dir = #LEFT
> \once \override FretBoard.fret-diagram-details.dot-color = #'black
> %% ...becomes...
> \once \overrideII FretBoard.fret-diagram-details
> \with {
>   barre-type = #'none
>   number-type = #'arabic
>   orientation = #'landscape
>   mute-string = #"M"
>   label-dir = #LEFT
>   dot-color = #'black
> }
> %%%%

Hm.  \with instead of = would even fit into the parser.  But that leaves
tweaks in the lurch.

-- 
David Kastrup

Reply via email to