From: David Kastrup Date: Sat, 8 Feb 2014 18:05:16 +0000 (+0100) Subject: Issue 3827: remove the necessity to have a \layout block in a \markup \score ... X-Git-Tag: release/2.19.3-1~25 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=00e7e96f8393ad1fe86f57cf90f4567142bd4e72;p=lilypond.git Issue 3827: remove the necessity to have a \layout block in a \markup \score ... 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. --- diff --git a/lily/parser.yy b/lily/parser.yy index 4b063960d6..b89c561ea8 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -3495,7 +3495,13 @@ markup_uncomposed_list: 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 (); } @@ -3572,7 +3578,13 @@ simple_markup: 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 (); }