On Wed 22 Sep 2021 at 10:41:47 (+1000), Mark Probert wrote: > Knute wrote: > > On Tue, Sep 21, 2021 at 4:19 PM Mark Probert wrote: > > > >> impressions-tune = { > >> << > >> \new ChordNames \harmony > >> \new Staff \melody > >>>> > > > > Mark, this looks close to something I'm doing (but better!) I have a > > question, though. You have the file impressions.ily and in that an > > impressions-tune variable and in that references to \harmony and > > \melody variables. How do you keep the harmony and melody variables > > from clashing with those in other .ily files? I use a naming > > convention, but this gets convoluted sometimes. > > I seem to rely on these variables being scoped locally to the file, and > this appears to work. All my different tune files have the same naming > convention -- melody, harmony, lyrics, etc. -- and lilypond deals with > it just fine. (One of the more knowledgeable scheme coders could > probably explain the scoping thing, but I using 2.20 it works :-) ) > > The caveat here is I never use those names--melody, harmony, > etc.--outside the .ily file, only their wrapper (impression-tune and > impression-hdr in this case). Perhaps a naive approach but it seems to > get the job done
I don't understand what scope, scheme and wrappers have to do with the the files that you are dividing your book into. What you outlined in the post at Wed, 22 Sep 2021 09:18:46 +1000 is a series of bookparts with unique names, each constructed with headers and music having unique names, but where the music had been constructed from two variables (harmony and melody) which you use over and over. So by the time you define harmony and melody for the second time, their previous values have been copied into the first, uniquely named music variable. When LP processes the file "Music.ly", it just sees the source as a single large file in which each \include "foo.ily" line has been replaced by the text in the appropriate "foo.ily" file (recursively). This method makes reasonable sense. But the example that you posted at Thu, 23 Sep 2021 11:12:52 +1000 doesn't appear to follow the method that you outlined above. In your example, tune-hdr and tune-name appear to be generic (used over and over), whereas in your outline, they were specific (impressions, impressions-hdr and impressions-tune all being named after the tune "Impressions" by John Coltrane). Consequently, Easybook.pdf contains a ToC listing two different tunes, followed by two pages with identical scores. Cheers, David.