lilypond-user
[Top][All Lists]
Advanced

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

Re: Getting the name of the context a scheme function was called from


From: David Kastrup
Subject: Re: Getting the name of the context a scheme function was called from
Date: Sat, 12 Jan 2013 08:47:47 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Paul Morris <address@hidden> writes:

> On Jan 11, 2013, at 12:40 PM, David Kastrup <address@hidden> wrote:
>
>>> But to do that I need the "translator object" (which seems to be an
>>> engraver?), and I'm not sure how to do that.  Maybe there is a way to
>>> get to it from the grob?
>> 
>> A grob can be announced in multiple contexts, so no.
>
> Ok, thanks.
>
>
>>> displaceHeads =
>>> #(define-music-function (parser location offsets) (list?)
>>> "
>>> Moves the NoteHeads, using (shift offsets)
>>> "
>>> #{
>>>   \once \override NoteColumn #'before-line-breaking = #(shift offsets)
>>> #})
>> 
>> At the time this is called, there are no live contexts.  You might want
>> to try fiddling with the context grob properties (huh, do we even have
>> functions for that?) directly in a function called via \applyContext.
>
> Ok, good to know about \applyContext.  After looking into it a bit,
> I'm not sure whether it will do what I need it to do, but that's fine
> since this is not essential.  It's just something that would be nice
> to have.  I can always just copy and paste the music and then add or
> remove the overrides that go in it (one version of the music for each
> of the two staff types).
>
> (I also should be able to write some code to automatically do the
> overrides in my custom staff context instead of having to enter them
> manually.  That would be the ideal solution, and a better place to put
> the effort.)

Uh, if you have a _custom_ staff context for which you want particular
overrides, you just do

\layout {
  \context {
    \Staff
    \name "MyStaff"
    \alias "Staff"
    \override ...
    \override ...
  }
}

at the bottom, and then in the music you use

\new MyStaff { ... }

and, of course, the overrides will be in every staff of that type, and
not anywhere else.

-- 
David Kastrup




reply via email to

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