Am Donnerstag, 29. April 2010 12:01:14 schrieb -Eluze: > -Eluze wrote: > > Reinhold Kainhofer wrote: > >> So, do you have any idea how I can override the header and paper blocks > >> in a > >> global init file? > > > > i have copied the whole init.ly to myInit.ly and then added *\include > > "myPaper.ly"* right after the \maininput line (nr. 25 in version 2.13.18) > > and then invoked lilypond with --init=… > > this raises the question why there is no such option, enabling to setup a > user specific environment or style without having to manipulate this > crucial file (and to adapt it for each new version).
Absolutely! It would also make lilypond-book much simpler, since currently the book preamble is added to all included .ly files. This looks awful if you click on an image to get the LilyPond file! AFAICS, "all" that needs to be done is to -) add a new option to lilypond e.g. -duser-init=settings.ily -) in init.ly include that file (if the option is given) right before \maininput In principle, all steps are easy (adding a command line option, checking for existence of command line option, including a file). The problem is the combination: The \include has to be done conditionally, and the check for the command line option has to be done in Scheme. This means that the include also has to be done in Scheme... Unfortunately, the processing of \include in a lilypond file is already done by the parser, so I don't know of any way to properly include a file using Scheme... I have tried: #(if (ly:get-option 'user-init) (display (format "\\include \"~a\"" (ly:get-option 'user-init))) (ly:parser-parse-string parser (format "\\include \"~a\"" (ly:get-option 'user-init)))) \maininput But this does not seem to have any effect: It includes the file (since a syntax error in the included file causes lilypond to fail), but the settings (header block) are not used... Cheers, Reionhold -- ------------------------------------------------------------------ Reinhold Kainhofer, reinh...@kainhofer.com, http://reinhold.kainhofer.com/ * Financial & Actuarial Math., Vienna Univ. of Technology, Austria * http://www.fam.tuwien.ac.at/, DVR: 0005886 * LilyPond, Music typesetting, http://www.lilypond.org _______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel