Re: ly:context-mod? list to string

2013-12-04 Thread Urs Liska

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


Re: ly:context-mod? list to string

2013-12-04 Thread David Kastrup
Urs Liska u...@openlilylib.org writes:

 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.

Well, in doubt the documentation string is relevant, but you have to
find it first.  git grep has the main advantage of being really fast.

When I know some half-answer, I usually git-grep with parts of it, see
where it can be found in the documentation, look for some context there,
feed it into a web search engine and cite the result in answers.

Alternatively, I use C-h i in Emacs and then the index for LilyPond's
documentation (which is rather good, and Emacs searches the LilyPond
doc's and follows index entries with autocompletion again basically
instantaneously).  And then I pick context, search in the HTML and so
on.

It's perhaps a bit of a letdown that a flat git-grep at the start often
leads to results faster than a hierarchical search, but then with
git-grep you know where to go in the hierarchy without having to
backtrack.

-- 
David Kastrup

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


Re: ly:context-mod? list to string

2013-12-03 Thread David Kastrup
Urs Liska u...@openlilylib.org writes:

 When I use ly:context-mod? for a parameter in a music function a
 string as the final part will be cut to list items.

 if I write
 \function \with { comment = This should be verified }

 then the ly:context-mod? variable will hold

 ((assign comment This should be verified))

 cdr-ing makes it (comment This should be verified)

 So what's the best (or canonic) way to make that (comment This should
 be verified) again?

**Bing** Now it is so again.

More seriously: that's what it always has been.  Use write instead of
display and you'll probably see what you want to.

If you use format for output, learn about the difference between ~a and
~s formats.

-- 
David Kastrup

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


Re: ly:context-mod? list to string

2013-12-03 Thread Urs Liska

Am 03.12.2013 20:39, schrieb David Kastrup:

Urs Liska u...@openlilylib.org writes:


When I use ly:context-mod? for a parameter in a music function a
string as the final part will be cut to list items.

if I write
\function \with { comment = This should be verified }

then the ly:context-mod? variable will hold

((assign comment This should be verified))

cdr-ing makes it (comment This should be verified)

So what's the best (or canonic) way to make that (comment This should
be verified) again?

**Bing** Now it is so again.

More seriously: that's what it always has been.  Use write instead of
display and you'll probably see what you want to.

If you use format for output, learn about the difference between ~a and
~s formats.



Thanks for pointing this out.
with write I indeed see what I want to.

Still driving me crazy all this ...

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


Re: ly:context-mod? list to string

2013-12-03 Thread Urs Liska

Am 03.12.2013 23:17, schrieb Urs Liska:

Am 03.12.2013 20:39, schrieb David Kastrup:

Urs Liska u...@openlilylib.org writes:


When I use ly:context-mod? for a parameter in a music function a
string as the final part will be cut to list items.

if I write
\function \with { comment = This should be verified }

then the ly:context-mod? variable will hold

((assign comment This should be verified))

cdr-ing makes it (comment This should be verified)

So what's the best (or canonic) way to make that (comment This should
be verified) again?

**Bing** Now it is so again.

More seriously: that's what it always has been.  Use write instead of
display and you'll probably see what you want to.

If you use format for output, learn about the difference between ~a and
~s formats.



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)




Still driving me crazy all this ...


+1



___
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: ly:context-mod? list to string

2013-12-03 Thread David Kastrup
Urs Liska u...@openlilylib.org writes:

 Am 03.12.2013 23:17, schrieb Urs Liska:
 Am 03.12.2013 20:39, schrieb David Kastrup:
 Urs Liska u...@openlilylib.org writes:

 When I use ly:context-mod? for a parameter in a music function a
 string as the final part will be cut to list items.

 if I write
 \function \with { comment = This should be verified }

 then the ly:context-mod? variable will hold

 ((assign comment This should be verified))

 cdr-ing makes it (comment This should be verified)

 So what's the best (or canonic) way to make that (comment This should
 be verified) again?
 **Bing** Now it is so again.

 More seriously: that's what it always has been.  Use write instead of
 display and you'll probably see what you want to.

 If you use format for output, learn about the difference between ~a and
 ~s formats.


 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.

 Still driving me crazy all this ...

 +1

You know you are agreeing with yourself?  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.

-- 
David Kastrup

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