lilypond-user
[Top][All Lists]
Advanced

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

Re: [WISH] A form of \noBreak that accepts a music expression?


From: Jim Long
Subject: Re: [WISH] A form of \noBreak that accepts a music expression?
Date: Thu, 17 Oct 2013 21:59:51 -0700
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, Oct 17, 2013 at 11:37:04PM +0200, David Kastrup wrote:
> Kieren MacMillan <address@hidden> writes:
> 
> > Hi Jim,
> >
> >> A technique like this might also be workable, but IMO a little
> >> less elegant syntactically:
> >> 
> >> \set unbreakableMusic = ##t
> >> \repeat unfold 6 c1
> >> \break
> >> \repeat unfold 6 c1
> >> \revert unbreakableMusic
> >> 
> >> This is not a huge priority, just a curiousity.
> >
> > I use these macros:
> >
> > pageBreaksForbid = { \override Score.NonMusicalPaperColumn
> > #'page-break-permission = ##f }
> > pageBreaksAllow = { \revert Score.NonMusicalPaperColumn 
> > #'page-break-permission }
> > lineBreaksForbid = { \override Score.NonMusicalPaperColumn
> > #'line-break-permission = ##f }
> > lineBreaksAllow = { \revert Score.NonMusicalPaperColumn 
> > #'line-break-permission }
> 
> The proposed interface
> 
> \noBreakMusic {
>   c1 | c1 | c1 |
>   c1 | c1 | c1 |
> }
> 
> could be implemented (with some 2.17) using
> 
> noBreakMusic =
> #(define-music-function (parser location music) (ly:music?)
>   #{ \temporary\override
>        Score.NonMusicalPaperColumn.line-break-permission = ##f
>      #music
>      \revert Score.NonMusicalPaperColumn.line-break-permission
>   #})
> 
> 
> The use of \temporary makes sure that the value afterwards is the same
> as before (rather than the default, though that would be fine for most
> use cases).

Excellent.  Thank you, David and Kieren.

Jim



reply via email to

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