Hi list and Gurus,

I encountered a strange behaviour with a layout block assigned to a variable.

As advised on lilypond-user I write

% Definition of \layout block in variable
% overrides a property
layoutVariable = \layout {
  \context {
    \Score
    \override Hairpin #'style = #'dashed-line
  }
}

which I can then reference with

\layout { \layoutVariable }

This seems to work but it interacts strangely with other \layout blocks written literally (or in include files).

Normally, multiple \context definitions get merged so they all apply. If there are overrides of the same properties the last one will apply.

But if I also have a \context definition in a variable this one doesn't get merged but (partially) hides the other contexts.

Take the attached file and move the definition and the call of the variable around to see that -> all context definitions that are parsed between the definition and the call of the variable are ignored.

I know that the order in which LilyPond encounters things is important.
But this one is beyond my proper understanding.

So could someone please tell me if that's correct behaviour or a bug?
And if it's correct then how should one properly deal with it? Should this be made more clear in the docs?

Thanks
Urs


\version "2.15.38"


\relative c' {
  c4 d e\< f g f\> e f g1\!
}

% Definition of \layout block in variable
% overrides a property
layoutVariable = \layout {
  \context {
    \Score
    \override Hairpin #'style = #'dashed-line
  }
}

% \first \layout block overrides one property
\layout {
  \context {
    \Score
    \override Hairpin #'color = #magenta
  }
}



% second \layout block overrides a second property
% Effects are merged
\layout {
  \context {
    \Score
    \override Hairpin #'thickness = 3
    %\override Hairpin #'style = #'dashed-line
  }
}


% Uncomment the following line to see that the third \layout block
% isn't merged but hides the other ones
\layout { \layoutVariable }

% move the variable definition and the call of \layoutVariable
% around to see that all \context blocks between the definition
% and the calling of this \layout block are ignored.


_______________________________________________
bug-lilypond mailing list
bug-lilypond@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-lilypond

Reply via email to