[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Make defining new contexts simpler with better \alias functionality
From: |
David Kastrup |
Subject: |
Re: Make defining new contexts simpler with better \alias functionality |
Date: |
Sat, 07 Mar 2015 10:19:20 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
Paul Morris <address@hidden> writes:
> Paul Morris wrote
>> (The only possible down side I see is that users may find it strange to
>> supply an output definition as a function argument, but I don't know of a
>> way around that.)
>
> Well, here's one possible way.
> -Paul
>
> \version "2.19.16"
>
> accept-like =
> #(define-scheme-function (parser location old new out)
> (symbol? symbol? ly:output-def?)
> (for-each
> (lambda (p)
> (let* ((sym (car p))
> (def (cdr p))
> (acc (ly:context-def-lookup def 'accepts)))
> (if (and (memq old acc) (not (memq new acc)))
> (ly:output-def-set-variable! out sym
> (ly:context-def-modify
> def
> (ly:make-context-mod
> `((accepts ,new))))))))
> (ly:output-find-context-def out))
> out)
>
> accept-like-layout =
> #(define-scheme-function (parser location old new)
> (symbol? symbol?)
> #{ \accept-like $old $new \layout { } #})
>
> accept-like-midi =
> #(define-scheme-function (parser location old new)
> (symbol? symbol?)
> #{ \accept-like $old $new \midi { } #})
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%
>
> \layout {
> \context {
> \Voice
> \name myVoice
> \alias Voice
> \override NoteHead.color = #blue
> }
> }
>
> \accept-like-layout Voice myVoice
An extra command seems like bikeshedding when you can just write
\accept-like Voice myVoice \layout { }
instead.
--
David Kastrup
- Make defining new contexts simpler with better \alias functionality, Paul Morris, 2015/03/06
- Re: Make defining new contexts simpler with better \alias functionality, David Kastrup, 2015/03/06
- Re: Make defining new contexts simpler with better \alias functionality, David Kastrup, 2015/03/06
- Re: Make defining new contexts simpler with better \alias functionality, Paul Morris, 2015/03/06
- Re: Make defining new contexts simpler with better \alias functionality, Paul Morris, 2015/03/06
- Re: Make defining new contexts simpler with better \alias functionality,
David Kastrup <=
- Re: Make defining new contexts simpler with better \alias functionality, Paul Morris, 2015/03/07
- Re: Make defining new contexts simpler with better \alias functionality, David Kastrup, 2015/03/07
- Re: Make defining new contexts simpler with better \alias functionality, Paul Morris, 2015/03/08
- Re: Make defining new contexts simpler with better \alias functionality, Paul Morris, 2015/03/08
- Re: Make defining new contexts simpler with better \alias functionality, David Kastrup, 2015/03/08
- Re: Make defining new contexts simpler with better \alias functionality, Paul Morris, 2015/03/08
- Re: Make defining new contexts simpler with better \alias functionality, Paul Morris, 2015/03/16
- Re: Make defining new contexts simpler with better \alias functionality, Colin Campbell, 2015/03/16
- Re: Make defining new contexts simpler with better \alias functionality, Paul Morris, 2015/03/17