Andrea Rossato <[EMAIL PROTECTED]> writes: > Nicolas Sceaux wrote: >> You can do >> #(define-module (lily)) >> #(export accidental->markup) >> #(define-module (*anonymous-ly-0*)) >> at the beginning of your file, or alternatively, copy and paste the >> `accidental->markup' definition from scm/accidental->markup to your >> input file. > > yes, both methods work perfectly. > Thank you very much. > > I'll now try to understand the hows and whys...;-)
The code in scm/chords.scm defines functions in the module named (lily). Some symbols are exported (the one introduced by `define-public'), thus they are part of the module interface, whereas some other are internal (the one introduced by `define'). `accidental->markup' is simply `define'd, not `define-public'ed, so this function is only accessible inside the (lily) module. In your input file, the module in which you work is (*anonymous-ly-0*), which "uses" the module (lily), that is to say it can use symbols that are exported by the (lily) module, which is not the case of `accidental->markup'. That's why we first exported it in the (lily) module: %% 1) switch to the (lily) module #(define-module (lily)) %% 2) export accidental->markup so that it can be used outside (lily) %% this is as if it had been defined using `define-public' iso %% `define'. #(export accidental->markup) %% 3) switch back to (*anonymous-ly-0*) #(define-module (*anonymous-ly-0*)) The second solution consisted in defining inside the module (*anonymous-ly-0*) a function called accidental->markup, that can be called inside (*anonymous-ly-0*). nicolas _______________________________________________ lilypond-user mailing list [email protected] http://lists.gnu.org/mailman/listinfo/lilypond-user
