Valentin Petzel <[email protected]> writes:
> Hello David,
>
>> Neither surprising nor an edge case.
>
> I would say it is quite surprising for most users, and definitely an edge
> case.
> It is essentially a case of `\applyContext` silently behaving differently
> when
> the Voice context was not created yet. And even you are getting this wrong:
>
>> That's because at the point of the first call, you haven't yet descended
>> into a Voice or even Staff context from the surrounding Score context.
>> So \applyContext prints the Stem.length setting for the Score context
>> which has not been changed (you only changed the default for every
>> bottom context).
>>
>> If you want to override Stem.length at the Score level, either write
>>
>> \override Score.Stem.length = ...
>>
>> in your \layout block, or write things like described in the docs,
>> namely
>>
>> \layout {
>> \context {
>> \Score
>> \override Stem.length = ...
>> }
>> }
>
> This creates the same output, because the top context is not Score, but
> Global. At the point in question not even a score context exists, so this is
> called in the global context. This we can also see when doing
Well, I would have pegged the Score context to be created at that point.
I am surprised that it isn't there yet, actually.
>
> ```
> testfn =
> #(lambda (context)
> (display context)
> (newline))
>
> \score {
> {
> \applyContext #testfn
> 4
> \applyContext #testfn
> }
> }
> ```
>
> which will display
>
>> #<Global_context Global () >
>> #<Context Voice () >
>
> So actually you’d have to do
>
> ```\override Global.Stem.length = #0```
Don't ever do that. Messing with the Global context is a big no-no. I
am not even sure you can from music.
> ```\context { \Global ... }```
That would likely work but be a really bad idea. If you want to
override global settings, use the Score context.
> This makes me wonder one more time if `\applyContext` should take an optional
> context argument, allowing to specify which context this should run on, and
> fail if this context is not found, such as in this mockup:
Easy enough to say
\context Something \applyContext ...
--
David Kastrup