Hi,

I would like LilyPond to insert a style file depending on the presence of a command line switch.

Inserting the following into "init.ly"

#(if (ly:get-option 'draft-mode)

     (ly:parser-include-string parser "\\include \"draft-mode.ily\""))


works when I add the option to the command line

lilypond -ddraft-mode file.ly

However I want to also be able to process options that have been included in the input file. Concretely the thought "draft-mode.ily" file will itself check for the presence of further command line options.
What I would like to write is a file like

\version "2.17.26"

#(ly:set-option 'draft-color-editorial)

...


and have "draft-mode.ily" check for this option
so that the relevant style sheet will include the relevant style sheet, but only if -ddraft-mode is set.


But it doesn't work, options set in the input file aren't respected.
So obviously LilyPond hasn't parsed the input file when the check is performed from within "init.ly".


So my question is: What would be the appropriate point to insert such a check? It should already see options set by ly:set-option commands but it should occur before any engraving has started.


Thanks for any hints
Urs


_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to