[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Another case of “temporary staff not ending”
From: |
David Kastrup |
Subject: |
Re: Another case of “temporary staff not ending” |
Date: |
Fri, 23 Sep 2022 14:02:29 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
Jean Abou Samra <jean@abou-samra.fr> writes:
> I believe this exhibits a bug:
>
> \version "2.23.14"
>
> {
> \new Staff { c'1 }
> \new Devnull { s1 }
> }
>
>
> I would have expected the staff to stop after one measure.
>
> Does anyone see a reason for this behavior being correct,
> or am I right that it is another bug similar to the “temporary
> staff not ending” bug fixed by Dan in 74af697126?
It is documented behavior. "Keeping contexts alive" starts with it:
Contexts are usually terminated at the first musical moment in which
they have nothing to do. So ‘Voice’ contexts die as soon as they
contain no events, ‘Staff’ contexts die as soon as all the ‘Voice’
contexts within them contain no events, etc. This can cause
difficulties if earlier contexts which have died have to be
referenced, for example, when changing staves with ‘\change’
commands, associating lyrics with a voice with ‘\lyricsto’ commands,
or when adding further musical events to an earlier context.
There is an exception to this general rule: inside of an ‘{...}’
construct (sequential music), the construct’s notion of the “current
context” will descend whenever an element of the sequence ends in a
subcontext of the previous current context. This avoids spurious
creation of implicit contexts in a number of situations but means
that the first context descended into will be kept alive until the
end of the expression.
In contrast, the contexts of a ‘<<...>>’ construct’s
(simultaneous music) expression are not carried forth, so enclosing
a context creating command in an extra pair of ‘<<...>>’ will keep
the context from persisting through all of the enclosing ‘{...}’
sequence.
You can either enclose your Staff in << ... >> or you can end its visual
impact using \stopStaff .
--
David Kastrup