[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Invisible notes, Scheme contexts
From: |
Erik Sandberg |
Subject: |
Re: Invisible notes, Scheme contexts |
Date: |
Tue, 13 Dec 2005 12:28:17 +0100 |
User-agent: |
KMail/1.8.3 |
On Tuesday 13 December 2005 10.55, Don Blaheta wrote:
> Quoth Han-Wen Nienhuys:
> > Don Blaheta wrote:
> > > 2) Is there a Scheme function to retrieve the _current_ context? It
> > > looks like all the functions require a context as an argument.
> >
> > What do you mean by "current" ? Where do you need it ?
>
> The context that is enclosing the point where the Scheme function is
> called. I guess it's probably in the location variable that is the
> second argument to a music-function, but I'm not sure how to access it
> from there.
>
> I'm actually particularly interested in getting the id of the current
> context, so I can store it in a variable and use the value of that
> variable later. I've also been having trouble typing in such an id
> literally; if I define a music function like
If you are a guru, you may want to look at \applycontext. Normally, scheme
functions are called before the music is interpreted, but with \applycontext,
functions can be called during iteration. Remember that contexts only exist
during iteration.
> foo = #(def-music-function (parser location str) (string?)
> #{ \context Voice = $str { \override NoteHead #'font-size = #3 }
> #})
>
> and then include in my code
>
> \foo "blah"
>
> I get an error
>
> funcs.ly:26:14: error: syntax error, unexpected STRING, expecting SCM_T
> or SCM_IDENTIFIER \foo "blah
> "
> error: errors found, ignoring music expression
Try
\foo #"blah"
> I can't figure out how to convert between Scheme strings and the
> lilypond-native things that look like strings but seem to be something
> else (often a LYRICS_STRING, though not in this case).
functions can only take scheme strings as parameters
(\bar and other commands aren't generic functions, they are hardcoded
commands; that's why a different syntax is allowed)
--
Erik
- Invisible notes, Scheme contexts, Don Blaheta, 2005/12/13
- Re: Invisible notes, Scheme contexts, Han-Wen Nienhuys, 2005/12/13
- Re: Invisible notes, Scheme contexts,
Erik Sandberg <=
- Re: Invisible notes, Scheme contexts, Han-Wen Nienhuys, 2005/12/13
- Re: Invisible notes, Scheme contexts, Nicolas Sceaux, 2005/12/13
- Re: Invisible notes, Scheme contexts, Erik Sandberg, 2005/12/14
- Re: Invisible notes, Scheme contexts, Trevor Bača, 2005/12/14
- Music function arguments, Han-Wen Nienhuys, 2005/12/14
- Re: Music function arguments, Trevor Bača, 2005/12/14
- Re: Invisible notes, Scheme contexts, Henrik Frisk, 2005/12/15
- Re: Invisible notes, Scheme contexts, Mats Bengtsson, 2005/12/15
- Re: Invisible notes, Scheme contexts, Nicolas Sceaux, 2005/12/15
- Re: Invisible notes, Scheme contexts, Karl Hammar, 2005/12/16