Peter Mayes <pe...@petermayes.org> writes:

> Ideally what I want is the first version, but with the stave extending
> just enough to go through the key signature.

Could you live with the following?

{
  \key c\minor
  c'1
  \key c\major
  \once\override Score.BreakAlignment.break-align-orders =
  #(grob-transformer 'break-align-orders
    (lambda (grob break-align-orders)
     (vector
      (vector-ref break-align-orders 2)
      (vector-ref break-align-orders 1)
      (vector-ref break-align-orders 2))))
  \bar "||"
}
It tells LilyPond to end the line formatted in a way as if it continued
to the next line.  This puts the key cancellation _before_ the bar line.

-- 
David Kastrup

Reply via email to