On Tue, Nov 14, 2023 at 8:09 PM Ken Ledeen <kled...@nevo.com> wrote:
> Hi All, > > From time to time I would like to include / exclude portions of the total > score. For now, in the crudest of ways, I just comment out the parts I > don't want (%{ ..... %}). That works, of course, but I was wondering if > there was a more elegant way. > > Ideally I would have some variable that I set to boolean #t or #f to > indicate what I want included. Then, instead of the %{ .... %} if would > be something like > > if includeFlag { ... } > > Then I wouldn't have to search around for where I'd included the comment > start and end brackets. > > I found the scheme if function but it didn't seem like an option. > > Many thanks in advance > Ooh, ooh! A chance to share something that I've been taught here! ;-) Not quite what you're looking for but it may give you ideas... In my case, I have a lot of LilyPond files that I recompile too often -- mostly because I learn some more clever way of doing something and then go back and change all of the old files. But, sometimes I want PDFs with a set page size for printing, and sometimes I want SVGs with infinitely long pages for the web. So a conditional based on an environment variable which is set based on an argument to the Bash script. So, a conditional expression and an include based on the value of the variable constructed: %%%%%%% % Use environment variable to decide if discrete pagination (PDF) or % continuous pagination (SVG). Default to SVG if none defined. % pageBreaking = #(string-append (getenv "HOME") "/.local/lib/lilypond/" (if (getenv "PAGE_BREAKING") (getenv "PAGE_BREAKING") "svg") ".ily") \include \pageBreaking %%%%%%%