It turns out that this is not really fixable in the backend since what
is called "layout" in the markup function definitions does not
actually correspond to \layout but rather to \paper. Very funny.
So this is solved in the parser itself when reading a \score or
\score-lines to be used in a markup or markup list by cloning
$defaultlayout as necessary (which simulates \layout {}) whenever the
score is without an output definition.
SCM nn = parser->lexer_->lookup_identifier ("pitchnames");
parser->lexer_->push_note_state (nn);
} '{' score_body '}' {
SCM nn = parser->lexer_->lookup_identifier ("pitchnames");
parser->lexer_->push_note_state (nn);
} '{' score_body '}' {
- unsmob_score ($4)->origin ()->set_spot (@$);
+ Score *sc = unsmob_score ($4);
+ sc->origin ()->set_spot (@$);
+ if (sc->defs_.empty ()) {
+ Output_def *od = get_layout (parser);
+ sc->add_output_def (od);
+ od->unprotect ();
+ }
$$ = scm_list_1 (scm_list_2 (ly_lily_module_constant ("score-lines-markup-list"), $4));
parser->lexer_->pop_state ();
}
$$ = scm_list_1 (scm_list_2 (ly_lily_module_constant ("score-lines-markup-list"), $4));
parser->lexer_->pop_state ();
}
SCM nn = parser->lexer_->lookup_identifier ("pitchnames");
parser->lexer_->push_note_state (nn);
} '{' score_body '}' {
SCM nn = parser->lexer_->lookup_identifier ("pitchnames");
parser->lexer_->push_note_state (nn);
} '{' score_body '}' {
- unsmob_score ($4)->origin ()->set_spot (@$);
+ Score *sc = unsmob_score ($4);
+ sc->origin ()->set_spot (@$);
+ if (sc->defs_.empty ()) {
+ Output_def *od = get_layout (parser);
+ sc->add_output_def (od);
+ od->unprotect ();
+ }
$$ = scm_list_2 (ly_lily_module_constant ("score-markup"), $4);
parser->lexer_->pop_state ();
}
$$ = scm_list_2 (ly_lily_module_constant ("score-markup"), $4);
parser->lexer_->pop_state ();
}