[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Consist engraver within loop
From: |
Urs Liska |
Subject: |
Re: Consist engraver within loop |
Date: |
Wed, 9 Mar 2016 09:02:35 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 |
*Bump*
Maybe it will be easier to understand the question (and thus provide an
answer) with a more stripped down MWE:
%%%%%%%%%%%%
\version "2.19.38"
removeStaffLines =
#(define-scheme-function (ctx)(symbol?)
#{
\layout {
\context {
% I want to generate the following context def
% from the ctx symbol? argument
\Staff
\remove "Staff_symbol_engraver"
}
}
#})
\removeStaffLines Staff
{
c'
}
%%%%%%%%%%%%
What I ultimately need to base my further work on is a way to replace
the explicit call of \Staff with a procedure that takes the context name
as symbol? and returns the context def that is expected there.
Any ideas?
Thanks
Urs
Am 09.03.2016 um 01:53 schrieb Urs Liska:
> Hi all,
>
> I want to write a wrapper function to "install" an engraver in a number
> of contexts. It works pretty well, but I want to make it better.
>
> This is what I have so far.
>
> \version "2.19.38"
>
> install =
> #(define-scheme-function (contexts)(symbol-list?)
>
> (if (member 'Score contexts)
> #{
> \layout {
> \context {
> \Score
> \consists "Clef_engraver"
> }
> }
> #})
> (if (member 'Staff contexts)
> #{
> \layout {
> \context {
> \Staff
> \consists "Clef_engraver"
> }
> }
> #})
> (if (member 'Voice contexts)
> #{
> \layout {
> \context {
> \Voice
> \consists "Clef_engraver"
> }
> }
> #}))
>
> \install Staff
>
> {
> c'
> }
>
> Clef_engraver doesn't make real sense, it's just there to have something
> compilable.
> In order to complete that I would have to repeat the conditional for all
> existing context - and wouldn't even catch custom contexts. So I would
> like to iterate over the symbol list to consist the engraver in a
> non-redundant manner. The problem is, I don't know how to get from the
> symbols like 'Score to the \Score incantation. I think it should go
> something like this:
>
> (for-each
> (lambda (ctx)
> #{
> \layout {
> \context {
> % specify context from ctx
> \consists "Clef_engraver"
> }
> }
> #}
> )
> contexts)
>
> This should work once I can "resolve" the comment
>
> Any pointers or solution would be appreciated
> Urs
>
> _______________________________________________
> lilypond-user mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/lilypond-user