\version "2.19.62"

\paper {
  ragged-bottom = ##t
  left-margin = 1.5\in
  indent = 0
  score-markup-spacing.padding = #15
}

\layout {
  \context {
    \Score
    \remove "Bar_number_engraver"
    \override InstrumentName.self-alignment-X = #RIGHT
    \override InstrumentName.padding = #1
  }
}

letStaffVanish = \set Staff.keepAliveInterfaces = #'()
showStaff = \set Staff.keepAliveInterfaces =
    #'( rhythmic-grob-interface
        multi-measure-rest-interface
        lyric-interface
        stanza-number-interface
        percent-repeat-interface)

fluteI = { c''1 b' a' g' f' e' d' e' }

fluteII = { c'1 d' e' f' f' e' d' c' }

\include "edition-engraver/edition-engraver.ily"
\consistToContexts #edition-engraver Score.Staff

\addEdition twoflutes

\markup \bold "This score shows that all three staves have music throughout."

\score {
  <<
    \new Staff
      \with { instrumentName = "Flute 1" shortInstrumentName = "F1" }
      \fluteI
    \new Staff
      \with { instrumentName = "Flutes 1&2" shortInstrumentName = "Fl 1&2" }
      \partcombine \fluteI \fluteII
    \new Staff
      \with { instrumentName = "Flute 2" shortInstrumentName = "F2" }
      \fluteII
  >>
}

\markup \bold "In this score: mm 1-2 combined, mm 3-5 separate, mm 6-8 combined."

\editionModList twoflutes scoreI.Score.A
  \break
  #'(3 6)
\editionMod twoflutes 1 0/4 scoreI.Staff.A
  \letStaffVanish
\editionMod twoflutes 1 0/4 scoreI.Staff.C
  \letStaffVanish
\editionMod twoflutes 3 0/4 scoreI.Staff.B
  \letStaffVanish
\editionMod twoflutes 3 0/4 scoreI.Staff.A
  \showStaff
\editionMod twoflutes 3 0/4 scoreI.Staff.C
  \showStaff
\editionMod twoflutes 6 0/4 scoreI.Staff.B
  \showStaff
\editionMod twoflutes 6 0/4 scoreI.Staff.A
  \letStaffVanish
\editionMod twoflutes 6 0/4 scoreI.Staff.C
  \letStaffVanish

\score {
  <<
    \new Staff
      \with { instrumentName = "Flute 1" shortInstrumentName = "F1" }
      \fluteI
    \new Staff
      \with { instrumentName = "Flutes 1&2" shortInstrumentName = "Fl 1&2" }
      \partcombine \fluteI \fluteII
    \new Staff
      \with { instrumentName = "Flute 2" shortInstrumentName = "F2" }
      \fluteII
  >>
  \layout {
    \context {
      \Score
      \editionID ##f scoreI
      \RemoveAllEmptyStaves
    }
  }
}

\markup \bold "In this score: mm 1-4 separate, mm 5-8 combined."

\editionModList twoflutes scoreII.Score.A
  \break
  #'(5)
\editionMod twoflutes 1 0/4 scoreII.Staff.B
  \letStaffVanish
\editionMod twoflutes 5 0/4 scoreII.Staff.A
  \letStaffVanish
\editionMod twoflutes 5 0/4 scoreII.Staff.B
  \showStaff
\editionMod twoflutes 5 0/4 scoreII.Staff.C
  \letStaffVanish

\score {
  <<
    \new Staff
      \with { instrumentName = "Flute 1" shortInstrumentName = "F1" }
      \fluteI
    \new Staff
      \with { instrumentName = "Flutes 1&2" shortInstrumentName = "Fl 1&2" }
      \partcombine \fluteI \fluteII
    \new Staff
      \with { instrumentName = "Flute 2" shortInstrumentName = "F2" }
      \fluteII
  >>
  \layout {
    \context {
      \Score
      \editionID ##f scoreII
      \RemoveAllEmptyStaves
    }
  }
}