bug-lilypond
[Top][All Lists]
Advanced

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

Re: music starting with afterGrace breaks layout


From: David Kastrup
Subject: Re: music starting with afterGrace breaks layout
Date: Thu, 23 Feb 2017 00:28:43 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Thomas Morley <address@hidden> writes:

> 2017-02-22 23:08 GMT+01:00 David Kastrup <address@hidden>:
>
>> Easy enough: wrap a (descend-to-context ... 'Bottom) around its
>> definition.  However, this breaks \displayLilyMusic in bewildering ways.
>
>
> Doing so, i.e.:
>
> afterGrace =
> #(define-music-function (fraction main grace) ((fraction?) ly:music? 
> ly:music?)
>    (_i "Create @var{grace} note(s) after a @var{main} music expression.
>
> The musical position of the grace expression is after a
> given fraction of the main note's duration has passed.  If
> @var{fraction} is not specified as first argument, it is taken from
> @code{afterGraceFraction} which has a default value of @code{3/4}.")
>    (let ((main-length (ly:music-length main))
>          (fraction (or fraction (ly:parser-lookup 'afterGraceFraction))))
>     (descend-to-context
>      (make-simultaneous-music
>       (list
>        main
>        (make-sequential-music
>         (list
>
>          (make-music 'SkipMusic
>                      'duration (ly:make-duration
>                                 0 0
>                                 (* (ly:moment-main main-length)
>                                    (/ (car fraction) (cdr fraction)))))
>          (make-music 'GraceMusic
>                      'element grace)))))
>      'Bottom)))
>
> \displayLilyMusic \relative { \time 2/4 \afterGrace g'2 { f8[ g] } f2 }
>
> returns:
>
> { \time 2/4
>   \context Bottom \afterGrace g'2 { f'8[ g'8] } f'2 }
>
> Is this not correct?

No, it isn't.  Because the original input did not contain \context
Bottom.  Now outcomment the definition in
scm/define-music-display-methods.scm for \afterGrace.  This should make
the original definition of \afterGrace surface when using
\displayLilyMusic in the above manner, but it rather bombs out with
strange errors:

Backtrace:
In /usr/local/tmp/lilypond/out/share/lilypond/current/scm/display-lily.scm:
 105: 56  (let* (# # #) (if result-string # #))
 109: 57* (and procs (any (lambda (proc) (proc expr)) procs))
 109: 58  [any #<procedure #f (proc)> (#<procedure #f (expr)> #<procedure #f 
(seq)>)]
In 
/usr/local/tmp/lilypond/out/share/lilypond/current/scm/define-music-display-methods.scm:
    ...
 338: 59  [format #f "~a~a{~v%~v_~{~a~^ ~}~v%~v_}" "" "" 0 1 ...
 374: 60*  [with-parameters* (#<procedure *indent* new-value>) (7) ...]
In /usr/share/guile/1.8/srfi/srfi-39.scm:
 112: 61   [more (#<procedure *indent* new-value>) (7) ...]
     ...
 119: 62   [with-fluids* (#<fluid 16>) (7) #<procedure #f ()>]
In unknown file:
   ?: 63*  [#<procedure #f ()>]
   ?: 64*  [map-in-order #<procedure #f (syntmp-music-39)> (# #)]
   ?: 65*  [#<procedure #f #> #]
   ?: 66*  [music->lily-string #]
In /usr/local/tmp/lilypond/out/share/lilypond/current/scm/display-lily.scm:
 104: 67   (if (ly:music? expr) (let* (# # #) (if result-string # ...)) ...)
 105: 68   (let* (# # #) (if result-string # #))
 109: 69*  (and procs (any (lambda (proc) (proc expr)) procs))
 109: 70   [any #<procedure #f #> #]
In /usr/share/guile/1.8/srfi/srfi-1.scm:
     ...
 459: 71   (or (pred (car ls)) (lp (cdr ls)))
 459: 72*  [#<procedure #f (proc)> #<procedure #f (expr)>]
In /usr/local/tmp/lilypond/out/share/lilypond/current/scm/display-lily.scm:
 110: 73   [#<procedure #f #> #]
In unknown file:
     ...
   ?: 74   (let ((?start #) (?music #) (?stop #)) (and (null? #) (null? #) ...))
   ?: 75*  [list-ref (# #) {2}]

<unnamed port>: In procedure list-ref in expression (list-ref 
(ly:music-property # #) 2):
<unnamed port>: Argument 2 out of range: 2

Basically this seems to trigger the code responsible for recognizing
\appoggiatura et al, and that indexes some list beyond its limits.  It
should have been possible to trigger this error previously (not
everything falling through this test would have looked like an
\afterGrace) but I have no idea how.

-- 
David Kastrup



reply via email to

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