[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Robustly include project-specific scheme files?
From: |
Ian Hulin |
Subject: |
Re: Robustly include project-specific scheme files? |
Date: |
Mon, 22 Oct 2012 03:44:37 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:16.0) Gecko/20121011 Thunderbird/16.0.1 |
On 21/10/12 22:00, Reedmace Star wrote:
> Dear LilyPond users,
>
> when working on LilyPond projects that require scheme coding, I
> sometimes find it convenient to collect scheme definitions in an
> external (but project specific) .scm file.
>
> Currently, I then simply call guile's "load" function to include
> it. Typical minimal setup:
>
> --- file my-scheme-defs.scm (same directory as master.ly) ---
>
> ;;; scheme definitions...
>
>
> --- file master.ly ---
>
> \version "2.16.0" #(load "my-scheme-defs.scm")
>
> %% do something ...
>
> ---
>
> This, however, only works when calling lilypond on master.ly from
> that same directory. The load command looks for the .scm file in
> the present working directory, but not in the directory containing
> the including file.
>
> No such restriction applies with the \include command, which works
> exactly as expected. And in fact I like to occasionally compile a
> .ly file from a different directory, usually to collect output
> files from a run with non-standard parameters.
>
> So I'm looking for a reasonably concise method to make this work
> with scheme loads, too. One obvious solution would be to shell out
> '#' prefixes and put everything into LilyPond include files, but
> that's not really pretty, if only because editors do a better job
> at syntax highlighting and indentation with pure scheme files than
> with embedded scheme code.
>
> Is there a better way?
>
> Best regards,
>
> Reedmace Star
>
If my-scheme-defs.scm is in path my-scheme-dir
--- file master.ly ---
\version "2.16.0"
% allow guile to find your file.
#(set! %load-path cons("my-scheme-dir" %load-path))
#(load-from-path "my-scheme-defs.scm")
%% do something ...
---
Cheers,
Ian