lilypond-devel
[Top][All Lists]

## Re: Simultaneous \key markings behave differently to \clef or \time.

 From: Jean Abou Samra Subject: Re: Simultaneous \key markings behave differently to \clef or \time. Date: Tue, 28 Jun 2022 16:45:24 +0200 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0

Le 28/06/2022 à 13:36, Richard Shann a écrit :

I've noticed that two \key in succession results in the first being
honored while the opposite is true for everything else I've tested.
Consider:
8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><
\version "2.22.0"

{
\time 3/4 \time 5/4 c''
}
{
\clef bass  \clef alto c''
}
{
c'' \bar "||" \bar ":..:"
}
{
\key f \major \key d \major c''
}
8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><

Not a problem except when using include files or (as in my case
generating the code programmatically.

Is there a good reason for this, or is it just a wrinkle that could be
fixed?


Hi,

Could you elaborate on your actual problem? I don't immediately se
why you would want to generate code that has simultaneous key changes
like this. Similarly, I don't understand the problem with include
files.

The wrinkle is actually on the side of \time, \clef and \bar.
Most stuff warns on duplicated events and accepts the first
(except if they are exactly the same, which masks this for the
user in many cases):

{ c'\p\f }
{ \mark "A" \mark "B" c' }
{ \tempo "A" \tempo "B" c' }
{ \tempo 4 = 120 \tempo 4 = 90 c' }
{
c'\tweak bound-details.left.text "rit" \startTextSpan
\tweak bound-details.left.text "rall" \startTextSpan
c'\stopTextSpan
}

The reason \time and \clef don't do this is that they are
implemented in a peculiar way. They don't use events but
set context properties. That allows them to work in \with
and \layout { \context { ... } }. (I have some vague plans
to allow events to work there, which would allow to make
\time and \clef more usual.) In the case of \bar, it just
appears to be a little less convenient than elsewhere due
to the way it works internally, and therefore not done.

Personally, I think warning and rejecting the second event
is a good idea. There are cases where might hope that you'd
be able to combine those events (like with \mark and \startTextSpan).
Duplicated events are the result of either a user error, or
a hope from the user that LilyPond will not be able to fulfill.
Either way, a warning is helpful.

Thanks,
Jean