From: David Kastrup Date: Sat, 2 Jul 2016 08:08:42 +0000 (+0200) Subject: Issue 4912: Fix output definition use in \book and \bookpart X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=22799b630629f695044ea6e5ee0c79b429e962f3;p=lilypond.git Issue 4912: Fix output definition use in \book and \bookpart The only explicit output definition blocks allowed in \book and \bookpart blocks were paper blocks. Output definitions supplied with Scheme expressions were erroneously interpreted like global output definitions, accepting all output definition types and overriding the global defaults with them. Now the only output definitions accepted as Scheme expressions are paper blocks. As opposed to previously, they actually set the paper block of the respective book or bookpart. --- diff --git a/lily/parser.yy b/lily/parser.yy index f184c5acb2..52fe450b7d 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -976,16 +976,12 @@ book_body: SCM proc = parser->lexer_->lookup_identifier ("book-score-handler"); scm_call_2 (proc, $1, $2); } else if (Output_def *od = unsmob ($2)) { - SCM id = SCM_EOL; - - if (to_boolean (od->c_variable ("is-paper"))) - id = ly_symbol2scm ("$defaultpaper"); - else if (to_boolean (od->c_variable ("is-midi"))) - id = ly_symbol2scm ("$defaultmidi"); - else if (to_boolean (od->c_variable ("is-layout"))) - id = ly_symbol2scm ("$defaultlayout"); - - parser->lexer_->set_identifier (id, $2); + if (to_boolean (od->lookup_variable (ly_symbol2scm ("is-paper")))) { + unsmob ($1)->paper_ = od; + set_paper (parser, od); + } else { + parser->parser_error (@2, _ ("need \\paper for paper block")); + } } else if (ly_is_module ($2)) { ly_module_copy (unsmob ($1)->header_, $2); @@ -1060,16 +1056,11 @@ bookpart_body: SCM proc = parser->lexer_->lookup_identifier ("bookpart-score-handler"); scm_call_2 (proc, $1, $2); } else if (Output_def *od = unsmob ($2)) { - SCM id = SCM_EOL; - - if (to_boolean (od->c_variable ("is-paper"))) - id = ly_symbol2scm ("$defaultpaper"); - else if (to_boolean (od->c_variable ("is-midi"))) - id = ly_symbol2scm ("$defaultmidi"); - else if (to_boolean (od->c_variable ("is-layout"))) - id = ly_symbol2scm ("$defaultlayout"); - - parser->lexer_->set_identifier (id, $2); + if (to_boolean (od->lookup_variable (ly_symbol2scm ("is-paper")))) { + unsmob ($1)->paper_ = od; + } else { + parser->parser_error (@2, _ ("need \\paper for paper block")); + } } else if (ly_is_module ($2)) { Book *book = unsmob ($1); if (!ly_is_module (book->header_))