Hi Urs,

On Sat, Jan 10, 2015 at 8:44 AM, Urs Liska <u...@openlilylib.org> wrote:

> Hi list,
>
> is it possible to collect the measure/measure-position values of all
> breaks in a compilation and output that to a logfile?
>

Yes, it is possible.  As far as I can tell, though, an engraver only has
access to explicit line- and page-breaks.  I could be wrong, and I hope I
am!

The following engraver will write line- and page-break info to the file
"output.txt" in the format (measure . measure-position).  Nothing will be
output for files that don't contain \break or \pageBreak.

 \version "2.19.15"

writeBreaksEngraver =
#(lambda (context)
   (let ((out (open-output-file "output.txt")))
     (make-engraver
      (listeners
       ((line-break-event engraver event)
        (let* ((ccc (ly:context-property context 'currentCommandColumn))
               (m (ly:context-property context 'currentBarNumber))
               (mpos (ly:context-property context 'measurePosition))
               (loc (cons m mpos)))
          (format out "Line break at ~a~%" loc)))
       ((page-break-event engraver event)
        (let* ((ccc (ly:context-property context 'currentCommandColumn))
               (m (ly:context-property context 'currentBarNumber))
               (mpos (ly:context-property context 'measurePosition))
               (loc (cons m mpos)))
          (format out "Page break at ~a~%" loc))))
      ((finalize trans)
       (close-output-port out)))))

{
  c'1
  \break
  c'1
  \break
  c'1
  \pageBreak
  c'1
  \break
}

\layout {
  \context {
    \Score
    \consists \writeBreaksEngraver
  }
}

>
> As mentioned yesterday I found a way to ask LilyPond to compile only a
> portion of a score by passing a range of measures.
> And if I had a generated list of all current breaks I could ask LilyPond
> to recompile just the staff (or page) I'm currently working on.
> Eventually this could be extended with the help of outputting single files
> for systems (à la lilypond-book-preamble). I think of having Frescobaldi
> display not a usual engraved PDF but concatenate these individual system
> images. Then the autocompile function could be used to only autocompile the
> "current" system - which would be a huge improvement in terms of
> responsiveness.
>
> As mentioned in my post a few minutes ago I haven't understood yet how
> engravers, listeners and friends actually work so I'd need some starters to
> get me going.
>
> TIA
> Urs
>
> _______________________________________________
> lilypond-user mailing list
> lilypond-user@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-user
>
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to