lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: macro for \once\override


From: David Kastrup
Subject: Re: macro for \once\override
Date: Sat, 29 Aug 2020 15:44:20 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Aaron Hill <lilypond@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

[Prev in Thread] Current Thread [Next in Thread]