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: David Kastrup
Subject: Re: [WISH] A form of \noBreak that accepts a music expression?
Date: Thu, 17 Oct 2013 23:37:04 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

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).

-- 
David Kastrup




reply via email to

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