lyp icon indicating copy to clipboard operation
lyp copied to clipboard

Make \pinclude etc more useful

Open noteflakes opened this issue 7 years ago • 0 comments

Issue #40 talked about making the lyp-provided include commands more "beautiful" but this is not really the problem with lyp-provided include commands. The problems with the current implementation are:

  • \pinclude is not differentiated enough from \include.
  • What does the "p" stand for? package?
  • In properly structured modular notation projects, files will normally be included only once. So including once should be the rule and not the exception.
  • the lyp-provided Lilypond commands (i.e. \pinclude etc) should be namespaced. It should be obvious that they come from lyp.
  • the conditional includes are actually not that useful, and they don't really get used that often. They might be useful when doing "polyfills" in order to support older versions of Lilypond
  • There's no conventional way to include a whole directory, or multiple files using a filename pattern.

So, we change the user-facing lyp interface as follows:

  • Rename the commands:
    • \pinclude becomes lyp-load
    • \pincludeOnce becomes lyp-include
    • \require becomes lyp-require
    • all old commands are deprecated, that is, display a warning
    • conditional include commands are not given new names, they're just deprecated
  • Make lyp-load and lyp-include more useful:
    • accept multiple arguments (for loading multiple files): \lyp-include tree templates music
    • accept directory references (for loading all files in a directory): \lyp-include utils
    • accept filename patterns (for loading files matching the pattern): \lyp-include utils/*
    • accept file references without extension, look for .ly or .ily files. If both exist, throw an error, otherwise load the existing one, if none exist, throw an error

noteflakes avatar Feb 19 '18 09:02 noteflakes