Am 04.12.2013 07:46, schrieb David Kastrup:
Urs Liska <u...@openlilylib.org> writes:

Thanks for pointing this out.
with "write" I indeed see what I want to.
But when I try to pass that to a ly:message I'll get

Wrong type argument in position 1 (expecting string): ("critical-remark")
ly:message expects a string.  You are passing it a list.  That its first
element is a string does not change that.

The documentation says:
LY_DEFINE (ly_message, "ly:message",
            1, 0, 1, (SCM str, SCM rest),
            "A Scheme callable function to issue the message @var{str}."
            "  The message is formatted with @code{format} and @var{rest}.")

So you need a format string here.

You can write (ly:message "~s\n" your-variable) here and get what you
want output in Scheme form.  If you don't want strings to be quoted, use
~a instead.

Thanks again. Now I see that this actually is what you already referred you in your previous email.


Still driving me crazy all this ...
+1
You know you are agreeing with yourself?

Yes.
I wanted to express my frustration about the fact that yesterday I thought I'd understood the issue and this morning - after changing a tiny bit - I'm as dumb as before. ;-)

When in doubt, use
git grep
on the LilyPond code base to find usage examples for functions.  I see

dak@lola:/usr/local/tmp/lilypond$ git grep ly:message
Documentation/contributor/programming-work.itexi:@tab @code{(ly:message msg args
input/regression/loglevels.ly:#(ly:message "Test message\n")
lily/warn-scheme.cc:LY_DEFINE (ly_message, "ly:message",
po/zh_TW.po:#. (ly:message (_ "Converting to `~a'...")
scm/backend-library.scm:    (ly:message (_ "Converting to `~a'...\n") pdf-name)
scm/backend-library.scm:    (ly:message (_ "Converting to ~a...") "PNG")
scm/backend-library.scm:  (ly:message (_ "Writing header field `~a' to `~a'...")
scm/documentation-lib.scm:  (ly:message (_ "Writing ~S...") x))
scm/framework-eps.scm:                                 (ly:message (_ "Writing ~
scm/framework-svg.scm:                (ly:message (_ "Updating font into: ~a") u
scm/graphviz.scm:    (ly:message (format #f (_ "Writing graph `~a'...") (port-fi
scm/lily.scm:        (else (ly:message ""))))
scm/lily.scm:                            (ly:message
scm/lily.scm:                            (ly:message
scm/lily.scm:            (ly:message (_ "Redirecting output to ~a...") log-name)
scm/lily.scm:        (ly:message "# -*-compilation-*-"))
scm/lily.scm:    (ly:message (_ "Invoking `~a'...\n") cmd)
scm/music-functions.scm:        (apply ly:message msg rest))))
scm/safe-lily.scm:   ly:message
scm/song.scm:  (ly:message "Writing Festival XML file ~a..." filename)
scm/song.scm:    (apply ly:message message (map pp args))))
scm/stencil.scm:          (ly:message "Writing ~a" outname)

anf there are a few examples fitting your use case.


Ah, I'd already grepped the git repo in the past, but didn't see it as a standard means when looking up usage information. Thanks.

Urs


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

Reply via email to