I've carved this off of some experimental work that allows expressing
in ly code the post-increment of a context property without
sensitivity to the number of times the music that requests it is
iterated. That is something that the rehearsal-mark engraver does,
and I believe it can only be done currently by an engraver/performer.
The implementation of \post is similar to the way \once reverts an
effect at the end of the time step. In fact, I first implemented it
the same way for the sake of simplicity; but after testing, I decided
to complicate it. \once reversions naturally occur in reverse order,
but it seems more natural for \post actions to run in the order given
in the ly code. It also seems more natural for all \once reversions
to precede all \post actions regardless of their order in the ly code.
Because of those differences, they are handled separately.
TODOs and questions:
Is \post per se worthy to be merged, or should I wait until the
whole group of post-increment features is ready, which is possibly
much later or never? It would be easier for me to finish \post and
merge it so that I have less to rebase on a regular basis. Can you
think of places that \post would be useful right now?
Test coverage is insufficient. I've provided a few cases to show
the basic idea.
Are there editor configs that I need to update to say that \post is
a built-in command? Other similar things?
Should this be called \post, \atEndOfTimeStep, or something else?
Diff:
"Dan Eble" eble@users.sourceforge.net writes:
Does it work like once, setting a property on a stream event? That
would seem important for quoted music and the part combiner.
Not yet have a good feeling for it. One application I can think of may
be the end of a \cadenza coinciding with a new bar start. \partial 0*1
does not work for that and it's super awkward to get this to work.
Maybe that tool could help?
--
David Kastrup
Yes.
Thanks. I understand these words, but not enough to tell what you have in mind as the problem to be solved.
I searched the issues for "cadenza" and came up with "Accidentals don't reset after explicit barlines" [#3640], but I don't see promise for a \post command to improve that.
Related
Issues: #3640
A cadenza halts LilyPond's timing. If you have a cadenza filling a bar, it doesn't actually fill the bar but only the moment at its start. Once \cadenzaOff happens, you are still at the start of the bar logically. \bar "|" changes the visuals but does not advance the bar number or trigger a threshold for new accidentals. That is a nuisance. I was wondering whether \post was able to smuggle something in that would allow LilyPond to think that the current bar has just ended, even though due to \cadenzaOn having stopped the timing up to \cadenzoOff, it is still at its start.
Looking at partial-iterator.cc, I think that \post might be the missing piece preventing \partial from being implemented with ly + scm. I'm going to experiment with that.
Last edit: Dan Eble 2020-02-06
Not the only missing piece. It looks like expressing what Partial_iterator does would also require alternative music that is iterated conditionally based on a test that occurs in context, something like this:
The effect of
\selectInContext predicate << T F >>would be to iterate onlyTif the predicate is true, and onlyFif the predicate is false. In this example, the procedureafter-startwould return true if the current moment > 0.Well, it was probably a bit much to expect something that did not budge with hand-catered code to yield to a more generic tool. Still, worth a try.
Passes make, make check and a full make doc.
Patch on tentative countdown for Feb 8th
"skipTypesetting doesn't behave well on its margins" [#1543] looks interesting.
Related
Issues: #1543
\postwould indeed offer some options to a person irked by [#1543]. (I admit it's not the most compelling case.)Related
Issues: #1543