I want to create my own display function that combines several commands into one function.

I have tried this

\version "2.19.15"

#(define bar #f)
#(define tmp #f)

meDisplay =
#(define-void-function (parser location message value)
   (markup? variable?)
   (display message)
   (display " : ")
   (display value)
   (newline)
   )

foo =
#(define-void-function (parser location mus)
   (ly:music?)
     (set! tmp (cons #{ b #} #{ cis #}))
     (meDisplay "tmp" tmp)
     (newline)
     (set! bar (acons 1 tmp bar))
     (display bar)
     (newline)
     (set! tmp (cons #{ cis #} #{ b #}))
     (display tmp)
     (newline)
     (set! bar (acons 2 tmp bar))
     (display bar)
     (newline)
     mus
)

{
  \foo c'
}

But I get this error:
Parsing...c:/users/ame/appdata/local/temp/frescobaldi-a77ofr/tmpe2f6wv/document.ly:19:6: In expression (meTrace "tmp" tmp): c:/users/ame/appdata/local/temp/frescobaldi-a77ofr/tmpe2f6wv/document.ly:19:6: Wrong type to apply: #<Music function #<procedure #f (parser location message value)>>
Exited with return code 1.

I'm probably doing a simple error(?) Like having the wrong type of define-???-function. I have tried a couple of different type of functions but ...

// Anders
--
English isn't my first language.
So any error or strangeness is due to the translation.
Please correct my English so that I may become better.

_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to