Hi Urs, try this line: #(eval ctx (current-module))
Of course normally eval is evil, but in this case you just evaluate the name - the symbol - to the definition, which is stored under that name inside the scope of the layout block.
HTH Jan-Peter Am 09.03.2016 um 09:02 schrieb Urs Liska:
*Bump* Maybe it will be easier to understand the question (and thus provide an answer) with a more stripped down MWE: %%%%%%%%%%%% \version "2.19.38" removeStaffLines = #(define-scheme-function (ctx)(symbol?) #{ \layout { \context { % I want to generate the following context def % from the ctx symbol? argument \Staff \remove "Staff_symbol_engraver" } } #}) \removeStaffLines Staff { c' } %%%%%%%%%%%% What I ultimately need to base my further work on is a way to replace the explicit call of \Staff with a procedure that takes the context name as symbol? and returns the context def that is expected there. Any ideas? Thanks Urs Am 09.03.2016 um 01:53 schrieb Urs Liska:Hi all, I want to write a wrapper function to "install" an engraver in a number of contexts. It works pretty well, but I want to make it better. This is what I have so far. \version "2.19.38" install = #(define-scheme-function (contexts)(symbol-list?) (if (member 'Score contexts) #{ \layout { \context { \Score \consists "Clef_engraver" } } #}) (if (member 'Staff contexts) #{ \layout { \context { \Staff \consists "Clef_engraver" } } #}) (if (member 'Voice contexts) #{ \layout { \context { \Voice \consists "Clef_engraver" } } #})) \install Staff { c' } Clef_engraver doesn't make real sense, it's just there to have something compilable. In order to complete that I would have to repeat the conditional for all existing context - and wouldn't even catch custom contexts. So I would like to iterate over the symbol list to consist the engraver in a non-redundant manner. The problem is, I don't know how to get from the symbols like 'Score to the \Score incantation. I think it should go something like this: (for-each (lambda (ctx) #{ \layout { \context { % specify context from ctx \consists "Clef_engraver" } } #} ) contexts) This should work once I can "resolve" the comment Any pointers or solution would be appreciated Urs _______________________________________________ lilypond-user mailing list [email protected] https://lists.gnu.org/mailman/listinfo/lilypond-user_______________________________________________ lilypond-user mailing list [email protected] https://lists.gnu.org/mailman/listinfo/lilypond-user
_______________________________________________ lilypond-user mailing list [email protected] https://lists.gnu.org/mailman/listinfo/lilypond-user
