Hi Kieren,
On Sun, Mar 2, 2025 at 12:06 PM Kieren MacMillan < kie...@kierenmacmillan.info> wrote: > Hi all, > > I’ve got lots of interconnected files in my libraries, and more than one > of them may \include the same file (e.g., ChoralStaff.ily and > VocalStaff.ily both \include Lyrics.ily). > > What’s the best way to deal with this nowadays? (cf. > https://lists.gnu.org/archive/html//lilypond-user/2010-01/msg00474.html, > from 15 years ago!) I know “it’s not a big deal”, but I’d love to know if > there’s a way not to just have it “automatically cut and paste into the > code stream” potentially dozens of times. Been away from LilyPond for a while, distracted with some other projects, so I'm not quite sure how state-of-the-art this might be. I ran across this in one of my include files that I've had kicking around for a while. Not even sure how long. It's from http://lsr.di.unimi.it/LSR/Item?id=894 and goes like this: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % From http://lsr.di.unimi.it/LSR/Item?id=894 % % includeOnce: include a file only if it hasn't already been included. % Usage: \includeOnce "my_file.ily" % By Marnen Laibow-Koser <mar...@marnen.org> % Based on http://lsr.di.unimi.it/LSR/Snippet?id=657 % and % http://lilypond.1069038.n5.nabble.com/conditional-include-td140471.html % includeOnce = #(define-void-function (filename) (string?) (if (not (defined? (string->symbol filename))) (begin (ly:parser-include-string (string-concatenate (list "\\include \"" filename "\""))) (primitive-eval (list 'define (string->symbol filename) #t))))) Don't know if this is quite what you need, but perhaps it can at least get you started. -- Michael