2014-02-18 18:06 GMT+01:00 <d...@gnu.org>: > That example is disturbing since it is not really about using a function > as an output definition, but rather about using a function as a > _context_ definition. You usually would not expect the above to work > but > \layout { indent = #0 \coloredNotes #blue } > to fail. But exactly that will happen. The actual purpose is more like > \layout { > \some-parameterized-function-from-my-standard-include-file-generating-the-whole-layout-block > #first-parameter #second-parameter #third-parameter > possibly additional tweaking > }
I'm not sure if this will help you, but i can show you something closer to a real-life example: i needed this stuff for generating custom contexts with a fuction. IIRC, before your improvement (i.e. before issue 3793) i had to do it like this: https://github.com/openlilylib/snippets/commit/012328f4caaa192f17f99a2eab7a07b41d095878 Your change should make it possible to use define-scheme-function (and drop the "(ly:parser-define! parser '$defaultlayout #{" bit) - if i remember correctly (haven't worked on it for some time). See also "create custom context definitions using a scheme function" thread on -user. > I think that turning \coloredNotes into a context definition producer by > just removing the \layout { and matching } without any other change > would work fine and make a nice example. You mean something like this? coloredNotes = #(define-scheme-function (parser location col)(color?) #{ \layout { \context { \Staff \override NoteHead #'color = #col } } #}) \coloredNotes #blue { c' } This example doesn't compile for me, i get "error: bad expression type" (using 82bc9ad690, pretty close to current master) Anyway, i'm sorry but i may not have more time to discuss this right now... :-( best, Janek _______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel