Re: Accessing Context Properties

2016-02-25 Thread tisimst
up a number of "concrete > examples", partly in the documentation, partly in snippets, partly in > code. > Thanks, David! Not sure why I didn't think of that before. I'll look through those search results and see if I can make sense of things. Best, Abraham -- View

Re: Accessing Context Properties

2016-02-25 Thread David Kastrup
tisimst writes: > On Thu, Feb 25, 2016 at 11:03 AM, David Kastrup [via Lilypond] < > ml-node+s1069038n187726...@n5.nabble.com> wrote: > >> tisimst <[hidden email] >> > writes: >> >> > David, >> > >> >> All of that cannot

Re: Accessing Context Properties

2016-02-25 Thread tisimst
ions as David has said. So that leaves custom > engravers (although I don’t really know how \applyContext fits into this). > > Maybe that helps? > Very much! Thank you. Best, Abraham -- View this message in context: http://lilypond.10

Re: Accessing Context Properties

2016-02-25 Thread tisimst
't the way to go and you've made that > > perfectly clear. I didn't even mean to imply in my previous response > > that I wanted to do those things with music functions. I don't care > > what the mechanism is. I just want to know what it is! > > So do you or don't you care t

Re: Accessing Context Properties

2016-02-25 Thread Paul Morris
Hi Abraham, > On Feb 25, 2016, at 12:28 PM, tisimst wrote: > > I'm asking this because I know that if I can get my hands on a grob, I know > how to access its properties (with ly:grob-property) and use that property's > value to make a change if I want (e.g., with

Re: Accessing Context Properties

2016-02-25 Thread David Kastrup
t music functions aren't the way to go and you've made that > perfectly clear. I didn't even mean to imply in my previous response > that I wanted to do those things with music functions. I don't care > what the mechanism is. I just want to know what it is! So do you or don't you

Re: Accessing Context Properties

2016-02-25 Thread Ben Strecker
ow > how to access its properties (with ly:grob-property) and use that property's > value to make a change if I want (e.g., with ly:grob-set-property!). I just > don't know the equivalent process for getting my hands on a context to access > its properties. I know there's ly:context-pro

Re: Accessing Context Properties

2016-02-25 Thread tisimst
now how to access its properties (with ly:grob-property) and use that property's value to make a change if I want (e.g., with ly:grob-set-property!). I just don't know the equivalent process for getting my hands on a context to access its properties. I know there's ly:context-property, but I just don

Re: Accessing Context Properties

2016-02-25 Thread David Kastrup
tisimst writes: > David, > > On Thu, Feb 25, 2016 at 9:28 AM, David Kastrup [via Lilypond] < > ml-node+s1069038n187720...@n5.nabble.com> wrote: > >> Abraham Lee <[hidden email] >> > writes: >> >> > All, >> > >> > In the

Re: Accessing Context Properties

2016-02-25 Thread tisimst
've partially been discussed in other threads). What approach would I want to follow in order to access the properties so I could make a change elsewhere? Thanks, Abraham -- View this message in context: http://lilypond.1069038.n5.nabble.com/Accessing-Context-Properties-tp187719p187721.html

Re: Accessing Context Properties

2016-02-25 Thread David Kastrup
Abraham Lee writes: > All, > > In the docs are numerous sections that discuss how to modify context > properties. This is not complicated. However, a handful of recent threads > on the user list have got me wondering about the correct way(s) of > _accessing_ these

Accessing Context Properties

2016-02-25 Thread Abraham Lee
All, In the docs are numerous sections that discuss how to modify context properties. This is not complicated. However, a handful of recent threads on the user list have got me wondering about the correct way(s) of _accessing_ these properties within, for example, a music function. The music

Re: Accessing context properties (e.g. the current key) from a music function?

2015-05-05 Thread Leah Velleman
The problem arises because \applyContext is evaluated later than \transpose. When music functions do their work, contexts have not been created yet, The output shows that the original binding of k is in effect when \transpose is called. Aha! Thank you — that makes sense.

Re: Accessing context properties (e.g. the current key) from a music function?

2015-05-01 Thread David Nalesnik
Hi Leah, On Thu, Apr 30, 2015 at 7:28 PM, Leah Velleman leah.velle...@gmail.com wrote: To do something like you want, you really would need access to context properties Ok — good to know I haven't missed some simple solution. It seems like there ought to be some way of smuggling

Re: Accessing context properties (e.g. the current key) from a music function?

2015-05-01 Thread David Nalesnik
On Fri, May 1, 2015 at 7:48 AM, David Nalesnik david.nales...@gmail.com wrote: test = #(define-music-function (parser location music) (ly:music?) (let ((k ERROR)) #{ \applyContext #(lambda (context) (set! k (ly:context-property context 'tonic))

Accessing context properties (e.g. the current key) from a music function?

2015-04-30 Thread Leah Velleman
I'm looking to write a \transpose-like music function that will need to be able to find out what the current key is. (In case it matters: The reason I'm doing this is to make it possible to enter music using movable-do solfege. The idea is to have a function \movableDo that will transpose from C

Re: Accessing context properties (e.g. the current key) from a music function?

2015-04-30 Thread David Nalesnik
On Thu, Apr 30, 2015 at 6:41 PM, David Nalesnik david.nales...@gmail.com wrote: P.S. Now I'm going to set out to break it... Well, with simultaneous music you do end up having to repeat the key. \test \new PianoStaff \new Staff \new Voice { \key re \major \voiceOne

Re: Accessing context properties (e.g. the current key) from a music function?

2015-04-30 Thread Leah Velleman
Oh goodness, something heinous happened to the formatting there. Let me try that again. k = ERROR test = #(define-music-function (parser location music) (ly:music?) #{ \applyContext #(lambda (context) (set! k (ly:context-property context 'tonic)) (display k) )

Re: Accessing context properties (e.g. the current key) from a music function?

2015-04-30 Thread Leah Velleman
Ah! I hadn't even gotten as far as thinking about key-change events *within* the scope of the music function, though you're right that those would be an issue too (and your suggestion looks like a sensible way of dealing with them). What I was trying to get at was the key that was current before

Re: Accessing context properties (e.g. the current key) from a music function?

2015-04-30 Thread David Nalesnik
Leah, On Thu, Apr 30, 2015 at 6:34 PM, Leah Velleman leah.velle...@gmail.com wrote: Ah! I hadn't even gotten as far as thinking about key-change events *within* the scope of the music function, though you're right that those would be an issue too (and your suggestion looks like a sensible way

Re: Accessing context properties (e.g. the current key) from a music function?

2015-04-30 Thread David Nalesnik
Hi Leah, On Thu, Apr 30, 2015 at 3:16 PM, Leah Velleman leah.velle...@gmail.com wrote: I'm looking to write a \transpose-like music function that will need to be able to find out what the current key is. (In case it matters: The reason I'm doing this is to make it possible to enter music

Re: Accessing context properties (e.g. the current key) from a music function?

2015-04-30 Thread David Nalesnik
Hi Harm, On Thu, Apr 30, 2015 at 6:36 PM, Thomas Morley thomasmorle...@gmail.com wrote: 2015-05-01 1:23 GMT+02:00 David Nalesnik david.nales...@gmail.com: %% \version 2.18 \language italiano % the closest preset :) test = #(define-music-function

Re: Accessing context properties (e.g. the current key) from a music function?

2015-04-30 Thread Leah Velleman
To do something like you want, you really would need access to context properties Ok — good to know I haven't missed some simple solution. It seems like there ought to be some way of smuggling information out of an \applyContext. But I guess there's a variable scope issue that keeps you

Re: Accessing context properties (e.g. the current key) from a music function?

2015-04-30 Thread Thomas Morley
2015-05-01 1:23 GMT+02:00 David Nalesnik david.nales...@gmail.com: Hi Leah, On Thu, Apr 30, 2015 at 3:16 PM, Leah Velleman leah.velle...@gmail.com wrote: I'm looking to write a \transpose-like music function that will need to be able to find out what the current key is. (In case it