Hello Kieren,

Is it not viable to load them once one your "main" file instead of on every
score that requires one of their functions? Or is it the case that you want
to be able to compile each song in the songbook independently, meaning you
need to include the "tweaks" in each score, which then causes great
inefficiencies when you include them all?

2018-01-30 13:22 GMT-03:00 Urs Liska <li...@openlilylib.org>:

>
>
> Am 30.01.2018 um 17:02 schrieb Urs Liska:
>
> ...
>
> If this is a regular case I would look for a way to include them only
> once. Including them multiple times definitely doesn't make sense as the
> file will be completely parsed again and all the definitions just
> overwritten.
>
> The approach I would use (doesn't necessarily mean it's the best one) is:
>
>    - replace the \include with a new function
>    - have that function add the included filels absolute path to some list
>    - check that list before including the file
>
> This is totally improvised, but with oll-core loaded you could do
> something along the lines of
>
> % provide a storage space
> \registerOption kieren.included-files #'()
>
> % in a loading function ('to-include' is the file to check:
> #(if (not (getOptionWithFallback `(kieren included-files ,to-include) #f))
>      (begin
>       (do-include-file to-include)
>       (setChildOption '(kieren included-files) to-include #t))
>
>
> just as a rough idea. Actually I don't know if the syntax of the functions
> is correct, but ...
>
>
> Thinking about it, that would be a path to writing an \includeOnce or
> \require command in oll-core.
> The downside with that idea is that coding tools (i.e. Frescobaldi) will
> be able to help much less than with regular includes: no auto-completion,
> neither for the include itself nor for variables defined in the included
> files. Also you can'T open the included file with ctrl-click.
>
> One issue I'm not sure about is whether that include function would
> properly work with LilyPond's include path or if you'd be forced to use
> absolute paths or paths relative to the directory (i.e. not paths that are
> relative to any item from the search path).
>
> What do you think, would that be a worthwile effort?
>
> Urs
>
> _______________________________________________
> lilypond-user mailing list
> lilypond-user@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-user
>
>
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to