lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Updating alists


From: David Kastrup
Subject: Re: Updating alists
Date: Thu, 30 Dec 2021 14:57:23 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Lukas-Fabian Moser <lfm@gmx.de> writes:

> Another question: With the (hopefully) upcoming changes in the
> script-alist structure (using symbols instead of strings as keys),
> we're quite close to being able to simply do
>
> \version "2.23.6"
>
> myScripts = \default-script-alist
> myScripts.tenuto.padding = 5
>
> \layout {
>   \context {
>     \Score
>     scriptDefinitions = #myScripts
>   }
> }
>
> {
>   a--
> }
>
> (One might also skip defining a new variable and instead change
> default-script-alist directly, but it has to be re-read in a \layout
> block anyway.)
>
> But at the moment, this does not work because the changed key is not
> being replaced in the alist but added at the beginning.

Why would that not work?

> If I see things correctly, this is the remark about "not coalescing
> multiple overrides of the same property" in nested_property_alist(...)
> in ily/nested-property.cc.
>
> Re-enabling the outcommented branch in that function (taking care to
> use assoc_tail instead of assq_tail and correcting the order of
> arguments to that call) basically works, but there's trouble ahead in
> the case where one does
>
> variable.entry = 15
> variable.entry.first = #'i-ve-decided-i-want-a-sublist-after-all
>
> which unfortunately is what happens if one \override's a nested
> property given by a callback
> (e.g. VerticalAxisGroup.staff-staff-spacing), or worse
>
> variable.entry = #'(some . pair)
> variable.entry.first = #'i-ve-decided-i-want-a-sublist-after-all
>
> since an entry that is a pair looks like the beginning of a sublist.
>
> On the other hand, I would expect people who are using
>
> Violin.I = { \someMusic }
> Violin.I = { \someNewMusic }
>
> would indeed like to be their first definition to actually be replaced
> (even if using \Violin.I in a score happens to produce only the most
> recent entry).
>
> Thoughts?

For stuff like


midiDrumPitches.ridecymbal = fis,,
midiDrumPitches.ridecymbala = b
midiDrumPitches.ridecymbalb = a
midiDrumPitches.crashcymbal = g


\midi
{
  \context {
    \Score
    drumPitchTable = #(alist->hash-table midiDrumPitches)
  }
}

you'll get across-session bleed of assignments when making them
destructive.  Another option is, of course, to do what amounts to an
in-place modification of a structural copy.

-- 
David Kastrup



reply via email to

[Prev in Thread] Current Thread [Next in Thread]