%% This file is processed without error.
%% Please see my feature request below.
\version "2.19.80"

INSTRUMENT = "Drum Sander"

\bookpart {
  %% Instead of defining INSTRUMENT above, I would like to define it
  %% here, which is not currently allowed, ...
%{
  INSTRUMENT = "Drum Sander"
%}
  \header { instrument = \INSTRUMENT }
  \score { c' }
}

\bookpart {
  %% ... and have LilyPond error on this next line because INSTRUMENT
  %% is not defined in this scope.
  \header { instrument = \INSTRUMENT }
  \score { e' }
}

%% This is my intended use.  I understand I can define variables at
%% the top level, but I'm concerned about having to take care that
%% none will carry over into the next bookpart.
%{
\bookpart {
  %% ... set several variables ...
  %% \include "part-template.ly"
}

\bookpart {
  %% ... set several variables ...
  %% \include "part-template.ly"
}

%% etc.
%}

%% This is my current work-around: define variables in the bookpart
%% header and read them in a roundabout way in the template.  I'll
%% spare you the details.
%{
\bookpart {
  \header {
    %% ... set several variables ...
  }
  \include "part-template.ly"
}
%}


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

Reply via email to