lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Where/when does LilyPond handle #(ly:set-option) commands?


From: Urs Liska
Subject: Where/when does LilyPond handle #(ly:set-option) commands?
Date: Fri, 20 Sep 2013 11:08:33 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130510 Thunderbird/17.0.6

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]