Re: Format LilyMusic as string

2018-05-24 Thread Urs Liska

Hi Jan-Peter,

thanks for that. This was indeed the issue, and -- now knowing it -- I 
can even understand the description in the reference ;-)



Am 24.05.2018 um 17:44 schrieb Jan-Peter Voigt:

ah, and you don't need o #{#}:


... you don't even need the music-function:

lilystring =
#(define-scheme-function (mus)(ly:music?)
   (with-output-to-string
    (lambda () (display-lily-music mus))
    ))
test = \lilystring \relative { c'4 }
#(display test)



lilystring =
#(define-scheme-function (mus)(ly:music?)
   (with-output-to-string
    (lambda () (displayLilyMusic mus))
    ))
test = \lilystring \relative { c'4 }
#(display test)


Am 24.05.2018 um 17:42 schrieb Jan-Peter Voigt:

lilystring =
#(define-scheme-function (mus)(ly:music?)
    (with-output-to-string
 (lambda () #{ \displayLilyMusic #mus #})
 ))
test = \lilystring \relative { c'4 }
#(display test)



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



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


Re: Format LilyMusic as string

2018-05-24 Thread Jan-Peter Voigt

ah, and you don't need o #{#}:

lilystring =
#(define-scheme-function (mus)(ly:music?)
   (with-output-to-string
(lambda () (displayLilyMusic mus))
))
test = \lilystring \relative { c'4 }
#(display test)


Am 24.05.2018 um 17:42 schrieb Jan-Peter Voigt:

lilystring =
#(define-scheme-function (mus)(ly:music?)
    (with-output-to-string
     (lambda () #{ \displayLilyMusic #mus #})
     ))
test = \lilystring \relative { c'4 }
#(display test)



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


Re: Format LilyMusic as string

2018-05-24 Thread Jan-Peter Voigt

Hi Urs,

I guess you are missing the wrapping lambda:

lilystring =
#(define-scheme-function (mus)(ly:music?)
   (with-output-to-string
(lambda () #{ \displayLilyMusic #mus #})
))
test = \lilystring \relative { c'4 }
#(display test)

HTH
Jan-Peter

Am 24.05.2018 um 17:33 schrieb Urs Liska:
I have a ly:music? argument and want to store the LilyPond 
representation as a string, that is I want to have a string with the 
content that \displayLilyMusic prints to the console.


 From what I know I have to provide a port to which \displayLilyMusic's 
output is redirected and that I can then store. But For some reason 
(well, that includes the "conciseness" of the Guile reference manual 
...) I don't get it done.



\version "2.19.80"
#(define format-ly-music (mus)
   (dont-know-what-to-do-here))

#(define my-var (format-ly-music #{ c' #}))

looks like a MWE for what I need.
 From the reference I would have thought that call-with-output-string 
would be what I need, but I don't get it to work as it complains about 
the "unspecified" argument.


Any pointers?
Thanks in advance
Urs

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



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


Format LilyMusic as string

2018-05-24 Thread Urs Liska
I have a ly:music? argument and want to store the LilyPond 
representation as a string, that is I want to have a string with the 
content that \displayLilyMusic prints to the console.


From what I know I have to provide a port to which \displayLilyMusic's 
output is redirected and that I can then store. But For some reason 
(well, that includes the "conciseness" of the Guile reference manual 
...) I don't get it done.



\version "2.19.80"
#(define format-ly-music (mus)
  (dont-know-what-to-do-here))

#(define my-var (format-ly-music #{ c' #}))

looks like a MWE for what I need.
From the reference I would have thought that call-with-output-string 
would be what I need, but I don't get it to work as it complains about 
the "unspecified" argument.


Any pointers?
Thanks in advance
Urs

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