lilypond-devel
[Top][All Lists]
Advanced

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

Re: new \context definition loses old context definitions


From: Mats Bengtsson
Subject: Re: new \context definition loses old context definitions
Date: Fri, 07 Jan 2005 10:33:28 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040913

As far as I understand, the following is what happens:

When you say something like:
  \context { \Staff
    \override TimeSignature #'style = #'numbered
    }
it is equivalent to two steps, namely, 1) redefining the definition of
the identifier called \Staff, i.e.:
Staff = \context {
    \Staff % = earlier definition of the identifier \Staff
    \override TimeSignature #'style = #'numbered
    }
and 2) using this definition, i.e.:
  \context{
    \Staff % Now with the new definition
  }

(The first step was introduced between 2.0 and 2.2)

What determines that the identifier is called \Staff and nothing else is
that the default definition of the identifier \Staff contains a line:
  \name Staff
This will also determine that the definition applies to Staff contexts
and not to other contexts.

The \RemoveEmptyStaffContext is a bit special, since it provides an
alternative definition of the Staff context type. For example, this
means that also the \RemoveEmptyStaffContext identifier contains a line
  \name Staff

In analogy with what I wrote earlier, this means that
\context{\RemoveEmptyStaffContext} is equivalent to the following
two steps. 1) Making a new definition of the \Staff identifier:
Staff = \context{ \RemoveEmptyStaffContext }
and 2) using this definition:
\context{\Staff}

Since the identifier \RemoveEmptyStaffContext is defined in
ly/engraver-init.ly, its definition will not change when you
redefine the \Staff identifier in you .ly file. If you think about
it, you will realize that this "bug" is the only way to make it
work.

   /Mats



Graham Percival wrote:
Is this a bug, or an undocumented "feature"?

Lily 2.4.2, OSX.  I have a global.ly, which contains
\layout{
  \context { \Staff
    \override TimeSignature #'style = #'numbered
    }
}

In my actual piece, I use
\include "../global.ly"
\layout{
  \context{
        \RemoveEmptyStaffContext
}}

(which presumably calls a \Staff context)
The piece loses the 4/4 time signature.


So when you write
\layout{ \context \Foo }}
LilyPond takes the default values for the Foo context, rather than
the current values.  If this is deliberate, I'll document it.  But if it's
not hugely difficult to fix, I would call this a bug.  :)


Not tested on 2.5.6, since we're still trying to build it.  We're getting
closer, though!  :)

Cheers,
- Graham



_______________________________________________
lilypond-devel mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/lilypond-devel

--
=============================================
        Mats Bengtsson
        Signal Processing
        Signals, Sensors and Systems
        Royal Institute of Technology
        SE-100 44  STOCKHOLM
        Sweden
        Phone: (+46) 8 790 8463                         
        Fax:   (+46) 8 790 7260
        Email: address@hidden
        WWW: http://www.s3.kth.se/~mabe
=============================================




reply via email to

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