Thomas Morley <[email protected]> writes: > I tried it similar to `overrideProperty' from `music-functions-init.ly' > But I didn't manage to get rid of the ""-signs, when specifying the > coctext. Is this possible? > > \version "2.15.38" > > offsetPositions = > #(define-music-function (parser location name offsets) (string? pair?) > > (let ((name-components (string-split name #\.)) > (context-name "Voice") > (grob-name #f)) > > (if (> 2 (length name-components)) > (set! grob-name (car name-components)) > (begin > (set! grob-name (list-ref name-components 1)) > (set! context-name (list-ref name-components 0)))) > #{ > \override $context-name . $grob-name #'positions = #(lambda (grob) > (let* ((func (assoc-get 'positions > (reverse(ly:grob-basic-properties grob)))) > (pos (func grob))) > (coord-translate pos offsets))) > #})) > > % example of use: > > \layout { > \offsetPositions Arpeggio #'(-1 . 1) > \offsetPositions "PianoStaff.Arpeggio" #'(-3 . 2) > }
Not at the moment. You could make the second string argument optional, but you would have to write this without dot between PianoStaff and Arpeggio, as \offsetPositions PianoStaff Arpeggio #'(... If you don't like the string, you could use string-or-pair? as predicate, and then use either Arpeggio or #'(PianoStaff . Arpeggio) That's currently the best sort of deal you can get from the parser. -- David Kastrup _______________________________________________ lilypond-user mailing list [email protected] https://lists.gnu.org/mailman/listinfo/lilypond-user
