Hello! I'm trying to define macros that would change tempo and print tempo indications at once. Since both the tempo and the markup are written after the note, I'm trying to use define-event-function.
That's what I'm trying to do: \version "2.15.36" rit = #(define-event-function (parser location) () #{ ^"rit." \tempo 4=40 #}) { \tempo 4=50 c'4 e'4 \rit g'2 } I get an error: event.ly:3:10: error: syntax error, unexpected \tempo, expecting $end ^"rit." \tempo 4=40 event.ly:5:27: error: error in #{ ... #} { \tempo 4=50 c'4 e'4 \rit g'2 } It turns out I cannot put more than one statement into the function. For example, this works: \version "2.15.36" rit = #(define-event-function (parser location) () #{ ^"rit." #}) { \tempo 4=50 c'4 e'4 \rit g'2 } And this works: \version "2.15.36" rit = #(define-event-function (parser location) () #{ \pp #}) { \tempo 4=50 c'4 e'4 \rit g'2 } But this doesn't work: \version "2.15.36" rit = #(define-event-function (parser location) () #{ ^"rit." \pp #}) { \tempo 4=50 c'4 e'4 \rit g'2 } event.ly:3:10: error: syntax error, unexpected EVENT_IDENTIFIER, expecting $end ^"rit." \pp event.ly:5:27: error: error in #{ ... #} { \tempo 4=50 c'4 e'4 \rit g'2 } There is an additional problem with \tempo. It returns a value that causes an error: \version "2.15.36" rit = #(define-event-function (parser location) () #{ \tempo 4=40 #}) { \tempo 4=50 c'4 e'4 \rit g'2 } event.ly:5:22: error: post event function cannot return #<Prob: Music C++: Music((elements #<Prob: Music C++: Music((metronome-count . 40) (tempo-unit . #<Duration 4 >) (text) (origin . #<location event.ly:3:2>))((display-methods #<procedure #f (expr parser)>) (name . TempoChangeEvent) (types general-music event tempo-change-event)) > #<Prob: Music C++: Music((context-type . Score) (element . #<Prob: Music C++: Music((value . #<Mom 10>) (symbol . tempoWholesPerMinute))((display-methods #<procedure #f (expr parser)>) (name . PropertySet) (types layout-instruction-event general-music) (iterator-ctor . #<primitive-procedure ly:property-iterator::constructor>)) > ))((display-methods #<procedure #f (expr parser)> #<procedure #f (expr parser)> #<procedure #f (expr parser)> #<procedure #f (expr parser)> #<procedure #f (expr parser)> #<procedure #f (expr parser)> #<procedure #f (expr parser)> #<procedure #f (expr parser)>) (name . ContextSpeccedMusic) (iterator-ctor . #<primitive-procedure ly:context-specced-music-iterator::const I think I could work it around by using more Scheme code and less Lilypond code in the macro. But I hope there is some easy way to do it. My files may be read not only by programmers, but also by musicians. I don't want them to be too hairy :) -- Regards, Pavel Roskin _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user