Skip to content

rhythmic-location reports wrong measure with Score.currentBarNumber #45

@uliska

Description

@uliska

This is the actual issue behind openlilylib/scholarly#67.

\version "2.19.82"

#(define (rhythmic-location grob)
   "Return the musical/rhythmical position of a given grob
    as a pair of a measure number and a moment in that measure.
    If the position can't be determined return an 'impossible'
    value in measure 0."
   (if (ly:grob? grob)
       (or (grob::rhythmic-location grob)
           (cons 0 (ly:make-moment 0/4)))
       (ly:error "Requested rhythmic-location of a grob, but ~a is not a grob," grob)))

{
  \override NoteHead.after-line-breaking = 
  #(lambda (grob)
     (ly:message "Location: ~a" (rhythmic-location grob)))
  c'1
  \set Score.currentBarNumber = 12
  c'1
}

prints

Location: (1 . #<Mom 0>)
Location: (2 . #<Mom 0>)

(instead of 1 and 12).

Obviously this is due to grob::rhythmic-location, and I'll ask on bug-lilypond whether that's a bug or wrong usage.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions