This is a partial (though more flexible) substitute for \on-the-fly
since it allows to replace
\on-the-fly #(lambda (layout props args) ...)
with
$(let ((fun (lambda (layout props args) ...)))
(set! (markup-command-signature fun) (list markup?))
fun)
Namely: ad-hoc written functions (probably most useful when written
using macros) can be employed as markup commands when preceded with $
as long as they have a suitable markup command signature attached.
This feature is mainly added for consistency with music functions.
extern Variable make_safe_lilypond_module;
extern Variable make_span_event;
extern Variable markup_p;
extern Variable make_safe_lilypond_module;
extern Variable make_span_event;
extern Variable markup_p;
+ extern Variable markup_command_signature;
extern Variable markup_list_p;
extern Variable midi_program;
#if !GUILEV2
extern Variable markup_list_p;
extern Variable midi_program;
#if !GUILEV2
sval = eval_scm (sval, hi, '$');
sval = eval_scm (sval, hi, '$');
+ if (YYSTATE == markup && ly_is_procedure (sval))
+ {
+ SCM sig = Lily::markup_command_signature (sval);
+ if (scm_is_true (sig))
+ {
+ yylval = sval;
+ int token = MARKUP_FUNCTION;
+ if (scm_is_true (scm_object_property
+ (sval, ly_symbol2scm ("markup-list-command"))))
+ token = MARKUP_LIST_FUNCTION;
+ push_markup_predicates (sig);
+ return token;
+ }
+ }
int token = scan_scm_id (sval);
if (!scm_is_eq (yylval, SCM_UNSPECIFIED))
return token;
int token = scan_scm_id (sval);
if (!scm_is_eq (yylval, SCM_UNSPECIFIED))
return token;
Variable make_safe_lilypond_module ("make-safe-lilypond-module");
Variable make_span_event ("make-span-event");
Variable markup_p ("markup?");
Variable make_safe_lilypond_module ("make-safe-lilypond-module");
Variable make_span_event ("make-span-event");
Variable markup_p ("markup?");
+ Variable markup_command_signature ("markup-command-signature");
Variable markup_list_p ("markup-list?");
Variable midi_program ("midi-program");
#if !GUILEV2
Variable markup_list_p ("markup-list?");
Variable midi_program ("midi-program");
#if !GUILEV2