lilypond-devel
[Top][All Lists]
Advanced

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

Naming _another_ lacking puzzle piece


From: David Kastrup
Subject: Naming _another_ lacking puzzle piece
Date: Sat, 13 Oct 2012 02:01:57 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux)

In ly/music-functions-init.ly I see code like the following:

crossStaff =
#(define-music-function (parser location notes) (ly:music?)
  (_i "Create cross-staff stems")
  #{
  \override Stem #'cross-staff = #cross-staff-connect
  \override Flag #'style = #'no-flag
  $notes
  \revert Stem #'cross-staff
  \revert Flag #'style
#})

There is a problem with that: in terms of stack operations, \override
and \revert are not opposing pairs: \override is pop+push (so that
multiple overrides in a row don't accrue cruft), \revert is pop.  So the
net effect of this sequence is "pop", while it should be neutral.

In the Scheme layer, we have the distinction between
make-grob-property-set (corresponding to user command \override, pop+push)
make-grob-property-override (not available as user command, just push)
make-grob-property-revert (corresponding to user command \revert, just pop)

So we need something like

crossStaff =
#(define-music-function (parser location notes) (ly:music?)
  (_i "Create cross-staff stems")
  #{
  \temporary\override Stem #'cross-staff = #cross-staff-connect
  \temporary\override Flag #'style = #'no-flag
  $notes
  \revert Stem #'cross-staff
  \revert Flag #'style
#})

and, as a corrollary, \temporary\whatever and \undo\whatever will be a
proper push/pop pair.

Now I find \temporary a fitting name.  It is just a bit cumbersome to
type.  \interim is hardly shorter, \adhoc seems a bit less descriptive.

Opinions?  It might also be possible to do

\temporary { \override Stem #'cross-staff = #cross-staff-connect
             \override Flag #'style = #'no-flag }
           $notes

and have this apply matching push/pop pairs around $notes.  It certainly
would at least cater for the most common need of a non-first-popping
push.  Perhaps we don't need both (at the current point of time, we
don't have either, and the naming is inconsistent with
make-grob-property-*), but as the crossStaff example shows, we need at
least one of those options.

-- 
David Kastrup




reply via email to

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