Thomas Morley <[email protected]> writes: > 2017-08-02 21:35 GMT+02:00 David Kastrup <[email protected]>: >> Jan-Peter Voigt <[email protected]> writes: >> >>> Hi Daniel and all others, >>> >>> you wrote about a critrical edition. There is scholarly: >>> https://github.com/openlilylib/scholarly >>> where you can add annotations to your score which then can be >>> collected in another file. >>> If you want to use the EE for tracking, you might use \applyContext >>> #(lambda (context) ... ) . >>> Of course you can use this function right inside your code. >>> >>> I am not at my computer right now, so I can not provide an example >>> (yet). But perhaps someone else can make use of this idea. >> >> \applyContext is called at the time music is interpreted (usually quite >> remote from the text entry).
Correction, sigh: the function handed to \applyContext is called at the time music is iterated. \applyContext itself is obviously called at the time it is encountered in the input. >> At that point, (*location*) tends to point to something nonsensical, >> and the execution of \applyContext's function does not pass a pointer >> to the originating music expression (where the origin would be >> recorded). >> >> So one needs to call (*location*) in a wrapper function that then uses >> the result in a closure passed to applyContext. _If_ one goes the >> applyContext route, that is. >> >> Another option would be to have applyContext fetch the origin and make >> it available in the %location fluid. That seems a bit wasteful but >> likely would not result in noticeable performance impacts. > > I had sent my previous mail before reading your reply here. > > Having taken the applyContext-approach, I see no drawbacks currently. > Needs more testing, ofc I'm pretty sure that... Wait. commit 99d6bb300e425bb86301eb370b0e9c57de9ee817 Author: David Kastrup <[email protected]> Date: Sat Jul 4 16:43:03 2015 +0200 Issue 4481: \barNumberCheck has bad error location diff --git a/lily/apply-context-iterator.cc b/lily/apply-context-iterator.cc index ce3fd032e2..5ed628491c 100644 --- a/lily/apply-context-iterator.cc +++ b/lily/apply-context-iterator.cc @@ -35,9 +35,9 @@ void Apply_context_iterator::process (Moment m) { SCM proc = get_music ()->get_property ("procedure"); - if (ly_is_procedure (proc)) - scm_call_1 (proc, get_outlet ()->self_scm ()); + with_location (get_music ()->get_property ("origin"), + proc, get_outlet ()->self_scm ()); else get_music ()->origin ()->warning (_ ("\\applycontext argument is not a procedure")); Darn it. Forget what I said unless we are talking about version 2.19.22 exactly. I fixed this in 2.19.23 for \applyContext already. -- David Kastrup _______________________________________________ lilypond-user mailing list [email protected] https://lists.gnu.org/mailman/listinfo/lilypond-user
