[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Make defining new contexts simpler with better \alias functionality
From: |
Paul Morris |
Subject: |
Re: Make defining new contexts simpler with better \alias functionality |
Date: |
Fri, 6 Mar 2015 15:13:23 -0700 (MST) |
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
\midi {
\context {
\Voice
\name myVoice
\alias Voice
}
}
\accept-like-midi Voice myVoice
\score {
\new myVoice { c'1 }
\layout {}
\midi {}
}
--
View this message in context:
http://lilypond.1069038.n5.nabble.com/Make-defining-new-contexts-simpler-with-better-alias-functionality-tp172723p172760.html
Sent from the Bugs mailing list archive at Nabble.com.
- 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 <=
- 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/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