[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: create custom context definitions using a scheme function
From: |
Janek Warchoł |
Subject: |
Re: create custom context definitions using a scheme function |
Date: |
Thu, 9 Jan 2014 21:21:21 +0100 |
2014/1/9 David Kastrup <address@hidden>:
> Janek Warchoł <address@hidden> writes:
>
>> Hi,
>>
>> I want to create custom context definitions using a scheme function.
>> Later on the function will take some arguments and actually do
>> something interesting, but right now i cannot get the most basic
>> examples to work:
>>
>> %%%%% why the override isn't applied here?
>>
>> test =
>> #(define-scheme-function (parser location)()
>> #{
>> \layout {
>> \context {
>> \Staff
>> \override NoteHead #'color = #blue
>> }
>> }
>> #})
>>
>> \layout { \test }
>
> Presumably because Scheme expressions in layout definitions are not
> interpreted. That's similar to a few other places where a local module
> can be manipulated by Scheme expressions like #(set-staff-size) and
> similar stuff where the expectation is that the return value should not
> get interpreted.
So how can i achieve what i want?
Which is, in pseudocode:
newStaffContext =
#(define-scheme-function (parser location name)(string?)
#{
\layout {
\context {
\Staff
\name #(concat name "Staff")
\alias "Staff"
instrumentName = #name
}
}
#})
\newStaffContext "Test"
\newStaffContext "Foo"
etc... (i hope it's clear what i want)
thanks,
Janek